Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: Apocalypse 4 on perl.com

by adamsj (Hermit)
on Jan 19, 2002 at 07:10 UTC ( [id://140037]=note: print w/replies, xml ) Need Help??


in reply to Re: Apocalypse 4 on perl.com
in thread Apocalypse 4 on perl.com

I know what you mean, but given (sigh) how often this'll be used, I think it's better to Huffman it. If anyone has a brilliant idea for a shorter keyword than default, I hope they'll send it in.

adamsj

They laughed at Joan of Arc, but she went right ahead and built it. --Gracie Allen

Replies are listed 'Best First'.
Re (tilly) 3: Apocalypse 4 on perl.com
by tilly (Archbishop) on Jan 22, 2002 at 04:58 UTC
    How about nothing?
    given ($foo) { when (1) {print "One";}; when (2) {print "Two";}; print "Didn't fit any case we know about"; }
    Indent to taste.

    UPDATE
    I don't think that "normal code" will often see a difference. While I can dream up situations where I think it matters, in all of them you are doing evil, awful things that you probably shouldn't. (Like using a default to shortcircuit out of a function.)

      That is already defined to work but doesn't solve the problem of the presense of a real "default" block changing the handling of exceptions.

              - tye (but my friends call me "Tye")
Re: Re: Re: Apocalypse 4 on perl.com
by Juerd (Abbot) on Jan 20, 2002 at 21:57 UTC
    If anyone has a brilliant idea for a shorter keyword than default, I hope they'll send it in.
    Not shorter, but I think it's easier to read and a lot better:
    given $foo { when 1 { ... } when 2 { ... } when we have tried all other options and really have nothing left but this last resort { ... } }


    :)

    2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

Re: Re: Re: Apocalypse 4 on perl.com
by scott (Chaplain) on Jan 20, 2002 at 21:15 UTC

    I pondered that for a bit but the best I could to was orelse. But that's even worse. :(.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-25 19:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found