Proposing GTFO syntax for exiting with error codes (similar to **die** in Perl):
HAI
I HAS A BOOL1 IZ 0
BOOL1 IZ 1 O RLY?
YA RLY
GTFO("BOOL1 NOT IZ 1")
KTHXBYE
Or:
HAI
I HAS A TITS IZ TRUE
TITS OR GTFO
KTHXBYE
Alternatively, KILL YOURSELF or BECOME AN HERO are options.
--- //Jeff Segall, 2007/05/29 14:29//
Elsewhere in this wiki, I've seen people use KTHXBYE as a sort of "exit..."
Here is my proposal:
* BBL - Exit with okay status from inside program
* DIAF - Exit with error status
* KTHXBYE - *Only* to be used at end of program source (opposite HAI)
--- //Kyle, 2007/05/30 17:25//
----
Exit with error should be SUPRISE BUTTSECHS!
...
WTF IZ boolvar
OMG TRUE
VISIBLE "true"
OMG FALSE
VISIBLE "false"
WTFBBQ?
SUPRISE BUTTSECHS! "I broked it."
KTHNX
...
--- //Church Tucker, 2007/05/30 18:21//
----
I really think that exception ''throw''ing should be "DO NOT WANT", with "O NOES" as the equivalent of ''catch''
----
I agree with "DO NOT WANT" and "O NOES" for throw/catch. Also, as someone who knows the value of being able to put debugging output everywhere :-P I think that GTFO or whatever our die statement will be should take an optional string. Whether or not this immediately gets dumped to standard out or if there is a standard way of handling debug output is another decision entirely, probably an implementation one.
--- //Ruben Rickard, 2007/06/07 16:39//
----
I like Kyle's suggestions that KTHXBYE is restricted to end of program source. I'd like add to the discussion "**ITS A TRAP**". This might work as either a C-style //exit(1)// in place of DIAF, or possibly even better taking the place of an //abort()// in that DIAF would still call any valid static destructors while **ITS A TRAP** would bail immediately, with error status.
So you might have something like:
HAI
CAN HAS STDIO?
PLZ OPEN FILE "LOLCATS.TXT"?
AWSUM THX
VISIBLE FILE
O NOES
ITS A TRAP
KTHXBYE
--- //msb, 2007/06/08 16:39//