Dan Sugalski wrote:
> ... you have to take into account the possibility that a
> variable outside your immediate scope (because it's been defined in an
> outer level of scope) might get replaced by a variable in some intermediate
> level, things get tricky.

Other things get "tricky" too. How about when the compiler
optimizes away a lexical with a constant? How about when
the compiler optimizes away a sub call because it's side-
effect-free and called with a constant? What about dead
code elimination? What about when the compiler selects a
register-based call op because of the prototype and then
the sub gets replaced with an incompatible sub at run-time?
What about inlining?

We're not just talking symbol table frobbing. The whole ball
of wax is on the table.

> Personally, I'd argue that it should print 'B'.

I totally agree. What's the point in injecting *broken* lexicals?!

Yeah, I can see it now. Perl 6 has three kinds of variables:
dynamically scoped package variables, statically scoped lexical
variables and "Magical Disappearing Reappearing Surprise Your
Friends Every Time" variables. Oh, and by the way, lexicals
are really implemented using "Magical Disappearing Reappearing
Surprise Your Friends Every Time" variables, so I guess we only
have two kinds of variables...

- Ken

Reply via email to