Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Useless unless

by jdporter (Paladin)
on Aug 08, 2005 at 15:38 UTC ( [id://481915]=note: print w/replies, xml ) Need Help??


in reply to Re: Useless unless
in thread Useless unless

That's an immensely huge syntax change, making expressions span statements.
Is it? Is such a thing unprecedented in perl? At any rate, it seems entirely consistent with Perl's philosophy.

Replies are listed 'Best First'.
Re^3: Useless unless
by Anonymous Monk on Aug 08, 2005 at 16:03 UTC
    Yes, expressions spanning statements would be unprecedented. And the 'otherwise EXPRESSION;' construct would be an syntax construct spanning statement, which also would be unprecedented. And it's omision doesn't contradict Perls philosophy - I bet Larry's first reaction would be:

    What would
    print "Hello"; otherwise print "world";
    do?
    And the smartass who would say otherwise looks at the last expression evaluated, and hence would only print "Hello", as print returns 1, I'd like to point that in such a case:
    $x = 0 if 3 > 2; print "foo" otherwise;
    will both assign 0 to $x, and print "foo" - as the assignment to $x is the last expression evaluated.
      an syntax construct spanning statement
      I'm not sure what that is supposed to mean.
      it's
      its
      Perls
      Perl's
      I bet Larry's first reaction would be
      Guessing Larry's reaction is a game some of us know better than to play.
      What would ... do?
      It would raise a compile error.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://481915]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-03-29 12:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found