HaloO,
David Green wrote:
The assignment happens only when foo() is invoked. However, the
variable $*Main::inner is declared at compile-time. Similarly, an "our
sub inner" inside foo() would declare the name, but you couldn't call
inner() until after running foo() --or bar()-- since you can'
On 2008-May-6, at 6:07 am, TSa wrote:
Just to ensure that I get the our behavior right, consider
sub foo
{
our $inner = 3;
}
sub bar
{
our $inner = 4; # redeclaration error?
}
say $inner;
Does this print 3 even when foo was never called?
No, it throws an error
HaloO,
David Green wrote:
On 2008-May-3, at 5:04 pm, John M. Dlugosz wrote:
What does this mean?
our sub outer ()
{
...
our sub inner () { ... }
}
inner; # defined?
>
I don't know why it would be any more illegal than "sub foo { our
$var... }". The inner sub would be in the package
On 2008-May-3, at 5:04 pm, John M. Dlugosz wrote:
What does this mean?
our sub outer ()
{
...
our sub inner () { ... }
}
inner; # defined?
I think this should be illegal. Nested named subs makes sense for
'my', with the rules of visibility matching the ability to clone the
closure
Jon Lang dataweaver-at-gmail.com |Perl 6| wrote:
On Mon, May 5, 2008 at 6:01 AM, John M. Dlugosz
<[EMAIL PROTECTED]> wrote:
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote:
No, because {...} is just a declaration. You can give a
definition later in the surrounding module/package/class.
On Mon, May 5, 2008 at 6:01 AM, John M. Dlugosz
<[EMAIL PROTECTED]> wrote:
> TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote:
>
> >
> > No, because {...} is just a declaration. You can give a
> > definition later in the surrounding module/package/class.
> > Within that scope there can be only one d
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote:
No, because {...} is just a declaration. You can give a
definition later in the surrounding module/package/class.
Within that scope there can be only one definition, of course.
I did not mean to use { ... } to mean declaration only, but to show
HaloO,
John M. Dlugosz wrote:
What does this mean?
our sub outer ()
{
...
our sub inner () { ... }
}
inner; # defined?
No, because {...} is just a declaration. You can give a
definition later in the surrounding module/package/class.
Within that scope there can be only one definit
What does this mean?
our sub outer ()
{
...
our sub inner () { ... }
}
inner; # defined?
I think this should be illegal. Nested named subs makes sense for 'my',
with the rules of visibility matching the ability to clone the closure.
But putting the nested sub into package scope