[REBOL] Re: To do or not to do?
From: sanghabum:aol at: 29-Nov-2001 5:30
Thanks again Romano,
> things are more simple of what you think. I have only removed the string and
> the function and (almost) everything works as you want.
> The only differences are:
I appreciate the effort you and all the others have taken to show me the
error of my ways.
I've reworked your code to fit my "real world" -- both
Boxcolor and Lastfield musy be strings -- they are sourced
from a spreadsheet. And it works with Compose.
I dunno, this sort of thing is a matter of taste as much as
anything, but I reckon the original "makelayout" is an easier
bit of code to follow and amend than the version below. The
version needs several Rebol tricks (to-set-word,
get to-word) that the (perhaps brain-dead and inelegant)
string 'em up
(And I guess when I write code, the target audience I have in
mind includes the maintenance programmer in 5 years time who
is not an expert in either the system or the languages used
but, nonetheless has to make modifications fast.)
Thanks all again,
b: box 99x100 green
c: box 45x33 green + 150.150.150
zz: text "last field"
;; Various bits of derived data needed
; a way with compose givem BoxColor is a String
MakeLayout: func [/local lay]
lay: compose [
b: box to-pair reduce [MaxBoxWidth MaxBoxDepth] (get to-word boxcolor)
c: box to-pair reduce [to-integer MaxBoxWidth / 2 to-integer MaxBoxDepth /
((get to-word boxcolor) + 150.150.150)
(to-set-word :lastfield) text "last field"
;; go do it
view layout makelayout