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

[REBOL] Bind and Use

From: al::bri::xtra::co::nz at: 5-Mar-2002 15:23

Patrick wrote:
> I would like to know more about bind and use.
'bind is used to make Rebol script written outside a context, appear to be written inside a context. For example:
>> Test: [print [1 2 3]]
== [print [1 2 3]]
>> x: make object! [
[ print: func [x] [rebol/words/print ["Result:" x]] [ f: does [do bind Test 'self] [ ]
>> x/f
Result: 1 2 3
>> Test: [
[ print [4 5 6] [ print [7 8 9] [ ] == [ print [4 5 6] print [7 8 9] ]
>> x/f
Result: 4 5 6 Result: 7 8 9
>>
'use allows one to reuse words. For example:
>> use [print] [
[ print: func [x] [rebol/words/print ["Result:" x]] [ print 1 + 2 [ ] Result: 3
>> >> print "test"
test
>>
I hope that helps! Andrew Martin Working for the Rebolution... ICQ: 26227169 http://valley.150m.com/