Re: Call for review: traits, lift
On Sun, May 03, 2009 at 08:20:17PM +0200, Moritz Lenz wrote: : If I understood the specs correctly, variables can be lifted, so you can : write : : sub f() {lift $a + $b}; : { : my $a is context = 3; : my $b is context = 4; : say f(); : } : : Is that correct? I think so. : And if yes, do these variables need to be context variables? Excellent question. I think the conservative thing to say is yes, but it's possible that the lift mechanism can't easily distinguish, unless it happens to use the same lookup that context vars use. But if we don't require the context declaration, it basically gives any called routine carte blanche on modifying your variables, which is probably a bad thing. So leave it in for now, I guess. Larry
Re: Call for review: traits, lift
Em Dom, 2009-05-03 às 21:15 -0700, Larry Wall escreveu: On Sun, May 03, 2009 at 08:20:17PM +0200, Moritz Lenz wrote: : If I understood the specs correctly, variables can be lifted, so you can : write : : sub f() {lift $a + $b}; : { : my $a is context = 3; : my $b is context = 4; : say f(); : } : : Is that correct? : And if yes, do these variables need to be context variables? Excellent question. I think the conservative thing to say is yes, but it's possible that the lift mechanism can't easily distinguish, In fact, i really think there isn't a sane way of distinguishing... lifting really means looking up from the perspective of the caller, so you see what the caller sees, so no need for $a and $b to be context... daniel
Re: Call for review: traits, lift
Moritz Lenz wrote: sub f (lift $a + $b); I mean 'sub f() { lift $a + $b }', sorry.