Branden foobar wrote:
> I expect Perl 6 will have some way to define its variables as being
> lexical-scoped in the sub they are used as default, either by the language
> default, or by a pragma, as `use scope "subs"; ', as it's proposed in RFC
> 64.
> If that's the case, I wonder how closures will be done, since having
> lexical-scope in every sub would mean that variables inside closures would
> automatically be lexical, being different from the ones in the sub that made
> the closure.
Well, since the former isn't going to happen, the latter isn't going to be
a problem.
> my suggestion for solving the problem is creating a new keyword of the
> my/our/your/their/his/... family that would explicitly `import' the variable
> from the parent sub.
Ugh - upvar? No thanks.
> I see a slightly conceptual advantage in having a keyword to indicate the
> closure, because the variable is actually stored together with the sub
> reference somehow, and having a keyword to indicate that would make it
> explicit.
Why should it be explicit? What ambiguity needs to be cleared up?
I like the fact that perl handles the grotty details for me.
--
John Porter
You can't keep Perl6 Perl5.