Changes between Version 20 and Version 21 of Commentary/Compiler/CoreSynType


Ignore:
Timestamp:
Nov 14, 2011 8:27:47 PM (4 years ago)
Author:
michalt
Comment:

Add a subsection about shadowing.

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/CoreSynType

    v20 v21  
    126126 The inner case does not need a {{{Red}}} alternative, because x can't be {{{Red}}} at that program point. Furthermore, GADT type-refinement might mean that some alternatives are not reachable, and hence can be discarded. 
    127127
     128== Shadowing ==
     129
     130One of the important things when working with Core is that variable shadowing is
     131allowed. In other words, it is possible to come across a definition of a
     132variable that has the same name (`realUnique`) as some other one that is
     133already in scope. One of the possible ways to deal with that is to
     134use `Subst` (substitution environment from
     135[[GhcFile(compiler/coreSyn/CoreSubst.lhs)]]), which maintains the list of
     136variables in scope and makes it possible to clone (i.e. rename) only the
     137variables that actually capture names of some earlier ones. For some more
     138explanations about this approach see
     139[http://research.microsoft.com/%7Esimonpj/Papers/inlining/index.htm Secrets of the Glasgow Haskell Compiler inliner (JFP'02)]
     140(section 4 on name capture).