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

[REBOL] Re: To do or not to do?

From: sanghabum:aol at: 29-Nov-2001 19:06

Hi Romano, Thanks for the detailed response...
> A string is like source code for Rebol. It must be compiled (loaded) and > then > run (interpreted). A block is like compiled code: it must only be run > (interpreted). > If the overhead is not a problem, you can compile your C code every time
> run it :-) (it is not just the same thing, I must admit :-()
In the case of my code generating Layouts, that's a once-a-run issue, so I suspect the time to compose-and-do is similar to string-and-do. But for the example that started this thread (validation rules on a database), your distinction makes it clear that a block is best where run time is an issue.
> In 5 years Rebol block will be the standard way to write code for beginners > :-)
Wouldn't that be great!?
> To end, in your code:
b: box to-pair reduce [MaxBoxWidth MaxBoxDepth] (get to-word boxcolor)
> ... > ((get to-word boxcolor) + 150.150.150) > can be > b: box to-pair reduce [MaxBoxWidth MaxBoxDepth] (to-word boxcolor) > ... > (to-word boxcolor) + 150.150.150
This is one of the gotchas in testing line-by-line from the console. Your simplification doesn't work from the console:
>> (to-word boxcolor) + 150.150.150
** Script Error: Cannot use add on word! value ** Near: (to-word boxcolor) + 150.150.150 But it does work in the Compose+Layout combination. It's been a useful training exercise working out why. In homage to Perl's slogan TMTOWTDI ("There's more than one way to do it") maybe we need a rebol riposte: TAMMEWTDI.BIWBETFITAD.JAOTRL). ("There's a much more elegant way to do it. But it won't be easy to find in the available documentation. Just ask on the Rebol list") <g>Colin.