[perl #113930] Lexical subs

2012-07-09 Thread Father Chrysostomos via RT
On Sun Jul 08 02:13:13 2012, thoughtstream wrote: > Father Chrysostomos pointed out: > > > I said when, not whether. :-) > > Isn't that just typical of me: confusing ontology with chronology. ;-) > > I'm afraid don't know the implementation details for Rakudo. It may be > bound as the surroundin

When do named subs bind to their variables? (Re: Questionable scope of state variables ([perl #113930] Lexical subs))

2012-07-09 Thread Father Chrysostomos via RT
I’m forwarding this to the Perl 6 language list, so see if I can find an answer there. [This conversation is about how lexical subs should be implemented in Perl 5. What Perl 6 does may help in determining how to iron out the edge cases.] On Sat Jul 07 13:23:17 2012, sprout wrote: > On Sat Jul 0

Re: When do named subs bind to their variables? (Re: Questionable scope of state variables ([perl #113930] Lexical subs))

2012-07-09 Thread Father Chrysostomos via RT
On Sat Jul 07 18:35:03 2012, tom christiansen wrote: > "Father Chrysostomos via RT" wrote >on Sat, 07 Jul 2012 17:44:46 PDT: > > > I’m forwarding this to the Perl 6 language list, so see if I can > find > > an answer there. > > I do have an answer from Damian, which I will enclose below, and

Re: [perl #113930] Lexical subs

2012-07-08 Thread Damian Conway
> But by using the term ‘variable’, which is ambiguous, you are not > answering my question! :-) Sorry. I tend to think of *every* variable name as merely being an alias for some underlying storage mechanism. ;-) > Does > > my $x; > for 1..10 -> $x {} > > cause the existing name $x to ref

Re: [perl #113930] Lexical subs

2012-07-08 Thread Moritz Lenz
On 07/08/2012 09:57 PM, Father Chrysostomos via RT wrote: > my $x; > my sub f { say $x } > for 1..10 -> $x { f(); } It prints Any() Any() Any() Any() Any() Any() Any() Any() Any() Any() (because Any is the default value in uninitialized variables). As an aside, you can run short Per

Re: When do named subs bind to their variables? (Re: Questionable scope of state variables ([perl #113930] Lexical subs))

2012-07-07 Thread Damian Conway
Father Chrysostomos asked: > What I am really trying to find out is when the subroutine is actually > cloned, Yes. It is supposed to be (or at least must *appear* to be), and currently is (or appears to be) in Rakudo. > and whether there can be multiple clones within a single call of > the encl

Re: When do named subs bind to their variables? (Re: Questionable scope of state variables ([perl #113930] Lexical subs))

2012-07-07 Thread Tom Christiansen
"Father Chrysostomos via RT" wrote on Sat, 07 Jul 2012 18:54:15 PDT: >Thank you. So the bar sub seems to be closing over the name @a (the >container/variable slot/pad entry/whatever), rather than the actual >array itself. >Since I don't have it installed, could you tell me what this does?

Re: When do named subs bind to their variables? (Re: Questionable scope of state variables ([perl #113930] Lexical subs))

2012-07-07 Thread Tom Christiansen
"Father Chrysostomos via RT" wrote on Sat, 07 Jul 2012 17:44:46 PDT: > I’m forwarding this to the Perl 6 language list, so see if I can find > an answer there. I do have an answer from Damian, which I will enclose below, and a Rakudo result for you. > [This conversation is about how lexica