Trey Harris wrote:
> In a message dated Fri, 1 Sep 2006, jerry gay writes:
>
>> On 9/1/06, Trey Harris <trey@eecs.harvard.edu> wrote:
>>> In a message dated Fri, 1 Sep 2006, Paul Seamons writes:
>>>
>>> > I'm not sure if I have seen this requested or discussed.
>>>
>>> This was definitively rejected by Larry in 2002:
>> perhaps a sentence to that effect belongs in S04, which has no mention
>> of nested statement modifiers, for or against.
>
> Well, that's because Synopses at least in theory only refer to changes
> from Perl 5. Perl 5 doesn't allow more than one statement modifier, and
> Perl 6 doesn't either.
In Perl 5, it's:
sub {sub {print 1 if 1}->() if 1}->() if 1;
In Perl 6, that's simplified to:
{{say 1 if 1}.() if 1}.() if 1;
Since expressions can always be a closure wrapped around a statement,
any statement can always be an expression.
Of course, that wasn't exactly what you were asking, but it does present
a practical solution when you want to:
{say $_ for =<>}.() if $do_read_input;
Which I just verified works fine under current pugs.
Thread Previous
|
Thread Next