Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: local vars in functions

From: lmecir:mbox:vol:cz at: 1-May-2002 17:44

Hi Romano, <Romano> 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 </Romano> No, I think, that my code works. (Test it, please, and let me know if anything doesn't work as it should). <Romano> or, to simulate only its side effects: catch [loop 1 [do does spec]] --- Ciao Romano </Romano> Why do you suggest this form? (I never wrote code looking like that - loop 1 or catch are unusual for me in this case) Cheers L