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

[REBOL] Re: dictionaries

From: anton::wilddsl::net::au at: 17-Feb-2006 12:47

Hi Cavva, As Sunanda pointed out, we use objects all the time for this. eg: make object! [print: "lost!"] It looks in the above example that we have redefined the word 'print. We have, but only the 'print in that object. The value of 'print in the default, global context is still the same and so 'print evaluates as usual. In the following example I am binding a block of words to a particular context. Those words which are found in the context will be bound to the context. The rest of the not-found words will keep their current binding: a: "global" b: "global" ctx: context [b: "local"] print bind [a b] ctx ;---> global local You can bind huge chunks of code if you like. This gives the same result as above: do bind [print [a b]] ctx ;---> global local Also if you want to get just one word out of a particular object, you can use IN and GET: print get 'a ;---> global print get in ctx 'b ;---> local Anton.