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 9:01

Hi Romano, nice code samples. I can say that you revealed some bugs in the Rebol interpreter behaviour as well as in my simulator. To obtain accurate results I would have to modify my simulator as follows: 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 ] Another inaccuracy discovered by you is in the definition of my UNBOUND? function. As you found out, it yields: o: blank-object [a:] word: in o 'a unbound? word ; == true A correct UNBOUND? function should have looked like this: 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 ] ] Now we get: unbound? word ; == false unbound? second first o ; == true Cheers L ----- Original Message ----- From: "Romano Paolo Tenca" Hi, Rethinking at my previous message, i must change one thing. At the start of the block context, the first (set)word is a strange word which i don't understand well. Could it be a bug? This is OK: foo: 0 foo2: 1
>> make object! [get 'foo2 foo: 2 foo2: 3]
** Script Error: foo2 has no value ** Near: get 'foo2 foo: 2 foo2: But not this :
>> make object! [get 'foo foo: 2 foo2: 3]
why not the error? This is OK:
>> make object! [print type? get/any 'foo2 foo: 2 foo2: 3]
unset But not this:
>> make object! [print type? get/any 'foo foo: 2 foo2: 3]
** Script Error: type? expected value argument of type: any-type ** Near: print type? get/any 'foo foo: What happens? What type of word is it? Seems an unbound word, but it does not give the standard error message of an unbound word (if i am not wrong, Ladislav's undefined? func returns true for 'foo but the error catched by the func is not the standard "not defined in this context") --- Ciao Romano