[REBOL] Re: Troube Calling Function within Object
From: jelinem1:nationwide at: 28-Nov-2000 15:43
BIND words known-word /copy
Binds words to a specified context.
BIND is a native value.
words -- A block of words or single word. (Type: block word)
known-word -- A sample word from the target context. (Type: word)
/copy -- Deep copies block before binding it.
must be a word which was defined within the same scope as when
you defined the 'player word. The problem then becomes one of finding this
word. For example:
; --------- START CODE -----------
player: make object! [
; Really this only sizes the block, ignoring the first element
find-records: func [arg [block!]][return length? arg]
some-func: func [table [string!] request [block!]][
bind some-word: to-word table 'known-word
return do get (in get some-word 'find-records) next request
print some-func "player" ["garbage" "b" "c" "d"]
;-------- END CODE ---------------
Good thing I tested this - not quite as straight forward as I thought, but
As long as you define 'player in the global context, it should be easy to
find another word to 'bind with.
- Michael Jelinek
Jamey Cribbs <[cribbsj--oakwood--org]>@rebol.com on 11/28/2000 02:36:57 PM
From: Jamey Cribbs <[cribbsj--oakwood--org]>@rebol.com on 11/28/2000 02:36 PM
Please respond to [rebol-list--rebol--com]
Sent by: [rebol-bounce--rebol--com]
Subject: [REBOL] Re: Troube Calling Function within Object
Michael, I get the concept of converting the string "player" to a word, but
how do I bind it to the actual player object?
On Tuesday 28 November 2000 15:14, you wrote: