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

[REBOL] [understanding 'bind]

From: rebol665::ifrance::com at: 7-Mar-2002 13:52

Hi rebollers, Hi Romano I am making progress on the exploration of the 'bind command. I have discovered it can be used for functions too. This is a short example where 'bind is used to access a locally defined 'print function instead of the global one. rebol [] o: make object! [ print: func [b [block!]][rebol/words/print compose ["o-print-> " (b)]] test1: does [print ["test"]] test2: func [b [block!]][do b] test3: func [b [block!]][do bind b 'self] ] o/test1 o/test2 [print ["Hello World!"]] o/test3 [print ["Hello World!"]] halt Results are : o-print-> test Hello World! o-print-> Hello World! Is it a good example ? Has anyone a practical illustration for that kind of usage ? Remarks and critics will be appreciated. Patrick PS : I have in mind to produce a small "'Bind for dummies" html document.