will enclose below, and a
Rakudo result for you.
[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.]
[...]
This question might be more appropriate: In this example, which @a
does the bar
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
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 Perl 6
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 refer
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.]
[...]
This question might be more appropriate: In this example, which @a
does the bar subroutine see (in Perl 6)?
sub foo {
my @a = (1,2,3
Father Chrysostomos via RT perlbug-comm...@perl.org 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
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
Just a short note: please, if this is implemented, make sure that either
Perl 6 conforms to Perl 5 behaviour, or the other way around.
--
korajn salutojn,
juerd waalboer: perl hacker [EMAIL PROTECTED] http://juerd.nl/sig
convolution: ict solutions and consultancy [EMAIL PROTECTED]
Juerd Waalboer skribis 2007-03-09 21:27 (+0100):
Just a short note: please, if this is implemented, make sure that either
Perl 6 conforms to Perl 5 behaviour, or the other way around.
Wanted to CC this list, but by accident replaced the To instead. Now
CC'ing p5p.
--
korajn salutojn,
juerd