[REBOL] Re: To do or not to do?
From: sanghabum:aol at: 29-Nov-2001 19:06
Thanks for the detailed response...
> A string is like source code for Rebol. It must be compiled (loaded) and
> run (interpreted). A block is like compiled code: it must only be run
> 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
time to compose-and-do is similar to string-and-do. But for the example that
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")