[REBOL] Re: Web site update
From: rotenca:telvia:it at: 2-Jul-2004 19:12
Hi Lad,
smart method to pass arguments!
Follow my cfunc which uses a variation..
My tests with a simple function: [[catch] "test" 'a b] [a + b]
Creation
0:00:00.235 RT
0:00:01.093 romano
0:00:02.704 ladislav
0:00:00.671 gabriele
Execution
0:00:00.016 RT
0:00:00.219 romano
0:00:00.328 ladislav
0:00:00.641 gabriele
cfunc: func [
"Make a closure"
[catch]
spec [block!]
body [block!]
/local spc item
] [
body: reduce [1 2 3 spc: copy [[throw]] body]
parse spec [
any [
to any-word! set item skip (
insert tail body to word! :item
insert/only insert tail spc to get-word! :item copy
[any-type!]
)
]
]
throw-on-error [body: make function! spec body]
change second :body [do make function!]
:body
]
---
Ciao
Romano