[REBOL] Re: tail-func: for the gurus
From: lmecir:mbox:vol:cz at: 19-Nov-2001 16:31
Here is an example (using your TAIL-FUNC):
>> f: tail-func [x y /local z] [
[ either x = 1 [y] [
[ f 1 1 - y
[ ]
[ ]
** Script Error: Duplicate function value: local
** Where: throw-on-error
** Near: func _*myspec2 [
_*loops: _*loops + 1
p1: [
set r refinement! (
either get bind to-word r 'comm [
append comm mold r
ref-mode: on
] [ref-mode: off]
)]
p2: [
set w word! (
if ref-mode [
append/only statement get bind to-word w 'comm
]
)]
ref-mode: on
comm: copy "_*innerfunc"
statement: copy []
parse _*myspec [any [p1 | p2]]
insert statement to-path comm
_*mycall: copy statement
if _*loops = 2 [
_*loops: 1
_*loop-detected: true
return]
until [
_*loop-detected: false
set/any 'ret do bind _*mycall '_*loops
not _*loop-detected]
_*loops: 0
_*loop-detected: false
_*mycall: copy []
return get/any 'ret]
<<Maarten>>
(...)
OK, rethought it some more, and despite that you are right I thought it
would
be enough (most of the time) to prefix all local variables with _* for
now....
> Can you give me a sample function that doesn't work?
(...)
<</Maarten>>