Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: command line [arguments] [Coding Style]

From: ed::brittlestar::com at: 6-Apr-2004 20:05

Max wrote:
> rebol prefered (and simpler) style: > > either none? system/script/args [ > print "no args" > ][ > print "args waiting" > ]
Someone else will probably jump on this, but see Zine Issue #2 for style suggestions on this particular example: http://www.rebolforces.com/zine/rzine-1-02/#sect10. The upshot is that: print pick ["no args" "args waiting"] none? system/script/args is probably closer to the "preferred" REBOL style envisioned by its creator. I'm no guru, but I might consider a reader-friendly form: arg-status: ["no args" "args waiting"] print pick arg-status (none? system/script/args) Or, if I knew I needed variations of this (i.e., for the other system/script values), maybe something like: status-msg: func [ "Return a pair of status messages in a block suitable for 'pick." subject [string!] ][ reduce [reform ["no" subject] reform [subject "available"]] ] print pick status-msg "args" (none? system/script/args) Other, wiser REBOLs can probably suggest better approaches. Best regards, Ed