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

[REBOL] Re: source code layout question

From: philb:upnaway at: 5-Jan-2002 9:58

Hi Joel, using the extra do [ before pasting is a really neat trick .... it will sure come in handy. Seems like the console was designed by/for people who code in style A Cheers Phil === Original Message === Hi, Carl, Carl Read wrote:
> ... It's only drawbacks I think are three extra spaces on > some lines (minor) ... >
Those are there to make the content of multi-line blocks (or multiple consecutive blocks, where some may be multi-line) all line up indented under the controlling expression.
> and not being able to cut and paste it into the Console - > a major disadvantage, I think. If it wasn't for that, it'd > be tempting to switch to it... >
Actually, I've been cutting and pasting with it (just with a tad of cheating ;-). I simply type into the console do [ then paste in whatever I've cut from wherever, then type a final ] and press return. That bit of extra typing (which does take more effort than just using control-C...) wraps everything in an extra attention-span-preserving block to keep the console's attention until the input expression is explicitly closed by the last right bracket.
> My current style (such as it is:) is much the sames as Petr's
> I'd write... > > either x = 0 [z][ > either y = 0 [head reverse z][ > while [x < y][ > y: y - x > append z "x" > ] > foo y x z > ] > ] >
I've tried that myself, but it seems to break the symmetry between the two blocks managed by the EITHER. Conceptually I "see" them as being at the same "level" under the control of the first argument to EITHER; therefore I prefer a typographical structure that makes them appear "side by side". Having one of them on the same line as EITHER and the controlling expression versus the other being indented below seems to hide their side-by-side relationship. I've certainly written my share of either blahblahblah [t-option][f-option] when all will fit on one line, however. -jn- -- ; sub REBOL {}; sub head ($) {@_[0]} REBOL [] # despam: func [e] [replace replace/all e ":" "." "#" "@"] ; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"} print head reverse despam "moc:xedef#yleen:leoj" ;