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

[REBOL] Re: local vars in functions

From: rotenca:telvia:it at: 1-May-2002 12:36

Hi Ladislav,
> blank-object: function [ > {make a blank object} > set-words [block!] > ] [object] [ > set-words: compose [return self (set-words)] > object: do does [ > make object! set-words > ] > set/any in object 'self () > object > ]
why not: blank-object: function [ {make a blank object} set-words [block!] ] [object][ unset in object: context compose [exit (set-words)] 'self object ] not so readable, i must admit (and 'object could be replaced by 'set-words to make it more unreadable): blank-object: func [ {make a blank object from a block of set-words} blk [block!] ] [ unset in blk: context compose [exit (blk)] 'self blk ]
> unbound?: function [ > {determines, if a word is unbound} > word [any-word!] > ] [err] [ > found? all [ > error? err: try [any-type? get/any :word] > err: disarm err > equal? err/id 'not-defined > ] > ]
If equal? err/id 'not-defined is false, the function returns false, but the status of the word is unknown, so i think it should be better to fire an error! --- Ciao Romano