[REBOL] Re: string to object - was: Ask
From: ammoncooke:y:ahoo at: 28-Sep-2001 1:22
----- Original Message -----
From: "Gregg Irwin" <[greggirwin--starband--net]>
To: <[rebol-list--rebol--com]>
Sent: Thursday, September 27, 2001 10:57 PM
Subject: [REBOL] Re: string to object - was: Ask
> Hi Ammon,
>
> We're getting close. :) I had the first two thing working that you posted,
> so we're on the right track there. The catch comes when the object you
want
> to use with 'in only exists as a string containing the name of the object.
> Using your example:
>
;)
> >>probe do in system to-word "options"
>
> What if it looks like this:
>
> >> sys: "system"
> >> probe do in sys to-word "options"
>
> How do I convert "system" for use with 'in? If I can do that, without
risk,
> I'm good to go. Sooooo, if what you say is true:
>
<snip>
> >>
>
> Then *this* is the answer!
>
> >> probe do in get to-word "system" to-word "options"
This should also work:
>>probe get in get to-word "system" to-word "options"
To check if it is poluting the Global Namespace:
>> probe do in get to-word "system" to-word "options"
make object!
<<cut out to save space>>
binary-base: 16
cgi:
make object! [
server-software: none
<<cut out for space>>
content-length: none
other-headers: []
]
]
>> ? cgi
Found these words:
decode-cgi (function)
>> ? get in system/options 'cgi
USAGE:
GET word /any
DESCRIPTION:
Gets the value of a word.
GET is a native value.
ARGUMENTS:
word -- Word to get (Type: any-word)
REFINEMENTS:
/any -- Allows any type of value, even unset.
== cgi
> Does that look right? I mean, it works, but is it safe?
>
> It doesn't work for this though:
>
> >> probe do in get to-word "system/options" to-word "cgi"
This is because 'system/options is of the datatype Path!. I am not
currently certain of the solution. I will toy with & let you know what I
find. ;)
> Dang. I need to sit down with the docs, and Ladislav's articles, and wrap
my
> brain around this side of things. I have this habit of jumping into the
> deep-end of things before learning to swim. :)
Just like me!
HTH!!
Ammon