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.

 
______________________________________________________________________________
ifrance.com, l'email gratuit le plus complet de l'Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
http://www.ifrance.com/_reloc/email.emailif


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to