Front page | perl.perl5.porters |
Postings from April 2010
Re: package block syntax
Thread Previous
|
Thread Next
From:
Ævar Arnfjörð Bjarmason
Date:
April 28, 2010 01:34
Subject:
Re: package block syntax
Message ID:
u2u51dd1af81004280134ka4e030dm2a21dcdcb18b0204@mail.gmail.com
On Wed, Apr 28, 2010 at 07:51, Rafael Garcia-Suarez <rgs@consttype.org> wrote:
> On 27 April 2010 22:24, Zefram <zefram@fysh.org> wrote:
>> The attached patch implements a Perl 6ism that seems worth imitating:
>> "package Foo { ... }" is equivalent to "{ package Foo; ... }". I think
>> this is worthwhile. I'm posting it for discussion, not for immediate
>> application, but if the consensus is in favour then this patch should
>> be usable as-is.
>
> I'm only committing the patch :
via IRC "commenting". I checked blead and it wasn't there :)
> - I'd like to see more tests (examples: is __LINE__ correct ? does
> goto work into / out of a package block ? do we have a nice error if
> the block isn't closed ? what about nested package blocks ?)
> - B::Deparse would need ajdusting
Yup, at least:
segfaults: package Foo {
goto inside/out of package: works:
use 5.012;
no warnings 'deprecated';
goto engage;
package Foo 0.10 {
engage:
say __PACKAGE__;
say eval '__PACKAGE__';
say __LINE__;
goto out;
say "moo";
}
out:
say eval '__PACKAGE__';
say __LINE__;
gives:
$ ./perl -Ilib package.pl
Foo
Foo
8
main
14
Thread Previous
|
Thread Next