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

[REBOL] Re: with ?

From: rebol:techscribe at: 4-Dec-2000 0:21

Hi Anton, try with: func [object [object!] block [block!] ] [ foreach [word value] block [ set in object to word! :word value ] ]
>> o: make object! [a: none b: none] >> probe o
make object! [ a: none b: none ]
>> with o [a: "this is a." b: "this is b."]
== "this is b."
>> probe o
make object! [ a: "this is a." b: "this is b." ] Note that this will generate an error if you pass a word in block that does not exist in object. A safer approach: with: func [object [object!] block [block!] ] [ foreach [word value] block [ if in object to word! :word [ set in object to word! :word value ] ] ] This version silently skips all words in block that are not defined in object. Hope this helps, Elan Anton wrote: