Hi,

I'm a bit confused about variable shadowing in Core. Since every variable has a
Unique I would've thought that there is no problem with that (i.e. a Unique is
globally unique). But in CSE.lhs:

  Note [Shadowing]
  ~~~~~~~~~~~~~~~~
  We have to be careful about shadowing.
  For example, consider
          f = \x -> let y = x+x in
                        h = \x -> x+x
                    in ...

  Here we must *not* do CSE on the inner x+x!  The simplifier used to guarantee 
no
  shadowing, but it doesn't any more (it proved too hard), so we clone as we go.
  We can simply add clones to the substitution already described.

and Simplify.lhs:

  -----------------------------------------
          *** IMPORTANT NOTE ***
  -----------------------------------------
  The simplifier used to guarantee that the output had no shadowing, but
  it does not do so any more.   (Actually, it never did!)  The reason is
  documented with simplifyArgs.

On the other hand it seems that simplifyArgs doesn't exist anymore. So is this
just a matter of outdated comments or is it actually possible that two different
variables in Core AST will have the same Unique?
If it is, then I have another question: is it possible that one will shadow the
other? In other words, is it possible to come across a variable with a Unique
that is the same as some other variable already in scope?

Thanks,
Michal

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to