Block as parameter (version 2 !!)
[1/2] from: info:id-net:ch at: 17-Aug-2002 19:28
Finally I still have a problem with the block as parameter,
Check it out those code in a VID solution:
append big-box reduce compose/deep [
'at (positioDepar + 467x-15) 'button (uppercase (to-string
lg/passer)) 110x16 [
procedure-passer (count1)
fonction-update (a-line)
]
];append
the a-line is a block before being composed into this big-box layout.. but
the "print mold" of this big-box is
....
....
fonction-update element1 element2 element3 .... etc.
....
....
Finally i cannot pass a block as a parameter within a VID layout because it
decomposed into elements of the block instead of a block...
So the result is that : the function is waiting on a block and the first
element passed is considered as a block..
How can I resolve that ?
[2/2] from: al::bri::xtra::co::nz at: 18-Aug-2002 11:52
Philippe Oehler wrote:
> Finally i cannot pass a block as a parameter within a VID layout because
it decomposed into elements of the block instead of a block...
> So the result is that : the function is waiting on a block and the first
element passed is considered as a block..
Best fix at the moment is to change from this:
fonction-update (a-line)
to this:
fonction-update [(a-line)]
Note the addition of the square brackets "[" and "]".
When the latest version of Rebol/View is available, with 'compose/only (from
latest Rebol/Core):
>> help compose
USAGE:
COMPOSE value /deep /only
DESCRIPTION:
Evaluates a block of expressions, only evaluating parens, and returns a
block.
COMPOSE is a native value.
ARGUMENTS:
value -- Block to compose (Type: any)
REFINEMENTS:
/deep -- Compose nested blocks
/only -- Inserts a block value as a block
You'll be able to write:
append big-box reduce compose/deep/only [
:)
I hope that helps!
Andrew Martin
ICQ: 26227169 http://valley.150m.com/