[REBOL] Re: local vars in functions
From: rotenca:telvia:it at: 1-May-2002 14:48
Hi Ladislav, looking at your
sim-make-object!: function [
{MAKE OBJECT! simulation}
[throw]
spec [block!]
] [set-words object sw] [
; find all set-words in SPEC
set-words: copy []
parse spec [
any [
copy sw set-word! (append set-words sw) |
skip
]
]
; create a blank object
object: blank-object set-words
; set 'self in object to refer to the object
object/self: object
; bind the SPEC to the blank object
spec: bind spec in object 'self
do spec
; return the value of 'self as the result
get/any in object 'self
]
I think it needs a correction:
do spec
must become
make object! spec
or, to simulate only its side effects:
catch [loop 1 [do does spec]]
---
Ciao
Romano