develooper Front page | perl.perl6.language | Postings from October 2006

Re: Nested statement modifiers.

Thread Previous | Thread Next
From:
Juerd
Date:
October 3, 2006 15:39
Subject:
Re: Nested statement modifiers.
Message ID:
20061003223900.GA31041@c4.convolution.nl
Aaron Sherman skribis 2006-10-03 13:46 (-0400):
> In Perl 6, that's simplified to:
>   {{say 1 if 1}.() if 1}.() if 1;

Which can also be written as:

    do { do { say 1 if 1 } if 1 } if 1;

Which if crammed together the way you wrote it, turns into:

    do {do {say 1 if 1} if 1} if 1;

Or perhaps you like this even better:

    do{do{say 1 if 1}if 1}if 1;

I find that hard to guess. I personally think the statement is confusing
anyhow, with or without whitespace. Besides, stacked "if"-statements
really don't make any sense. We've already got "and" for that! :)

    say 1 if 1 and 1 and 1;

Oh, and 1 is always true. So you could just write:

    say 1;

Which seems like a great improvement. 

It may be more useful to discuss this issue using less contrived
examples. :)
-- 
korajn salutojn,

  juerd waalboer:  perl hacker  <juerd@juerd.nl>  <http://juerd.nl/sig>
  convolution:     ict solutions and consultancy <sales@convolution.nl>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About