[EMAIL PROTECTED] wrote:

> >> ray: func [] [ print "Hi, I'm Ray" ]
> >> test: make object! [
> [     bob: func [] [ print "Hi, I'm Bob" ]
> [    ]
> >>
> >> type? :ray
> == function!
> >> type? :test/bob
> Hi, I'm Bob
> == unset!

Here you are evaluating text/bob. the function bob in the object is is
evaluated which leads to the evaluation of the expression print "Hi, I'm
Bob". The print function does not return a value, which in REBOL
evaluates to the value unset. The unset value is passed to type? which
returns the type of unset. The type of unset is unset!


>
> >> type? test/:bob
> ** Script Error: Invalid path value: ?function?.
> ** Where: type? test/:bob
>

You must have defined a global function called bob in addition to the
bob function defined in the test object. If you didn't have a global bob
function defined, then the error you would be getting here would be:L
** Script Error: bob has no value.
** Where: test/:bob

However, if I define a global bob function, then I get the same error as
you do. Your error reports that REBOL has first evaluated the expression
:bob. It evluated to a function, and now REBOL is trying to use the
function as part of the path test/:bob. I.e. the path REBOL is dealing
with is test/?function? (?function? is the internal tag used to
designate a function). REBOL is complaining that you cannot use a value
of type function! as part of a path construct.

>
> How do I find out if test/bob is a function?

try
>> type? get in test 'bob
== function!

>
>
> >> do to word! "ray"
> Hi, I'm Ray
> >> type? to word! "ray"
> == word!

Not exactly surprising. You converted the string "ray" into a word using
to word!. Of course the its type is a word!. What else?


>
> >> function? to word! "ray"
> == false

Of course the expression to word! "ray" does not return a function. It
returns the word ray.  And since word! <> function!, function? will
report that the value ray of type word! is not a value of type fnction!


>
> >> type? :ray
> == function!

Here REBOL first retrieves ray's value, which is the function it is
associated wtih, and passes the function value to type? I.e. the type?
function never gets to see the word ray. The rype? function reports the
type of the value associated with ray. And that is a value of type
function!

>
>
> Is the type lost for good?

The type is not lost for good.

>
> It looks like what I need a get-word function

Here it is:
>> type? get to word!  "ray"
== function!

Hope this helps,

Elan


Reply via email to