grabbing value of a variabe by its name?

Donald Major Donald.Major at sas.com
Thu Jul 25 15:13:37 UTC 2002


Maybe what you really want is to just use some sort of *Dictionary instance.

Ragnar Hojland Espinosa wrote:

>On Thu, Jul 25, 2002 at 07:09:51AM -0800, Alan Kay wrote:
>  
>
>>I think the construct that is most like you are looking for would be 
>>to type the following into a workspace and execute them with a "cmd 
>>(or alt) d":
>>
>>foo _ 'hello'.
>>bar _ 'world'.
>>baz _ { foo. bar}.
>>
>>If you then type
>>
>>baz
>>
>>and execute this with a "print it" -- a "cmd (or alt) d", then you will see
>>
>>#('hello' 'world')
>>    
>>
>
>We're on different wavelengths or I'm a bit obtuse today ;)  That would be
>what I was looking for if there was a way to examine the array and figure
>out the 'hello'--foo relation.  Or is there a way?
>
>I'll restate my problem again.
>
>     $a = "hello";
>     $b = "world";
>     $c = "a";
>     print $$c;     # references $a, and therferoe prints hello
>     $c = "b";
>     print $$c;     # and now prints world
>
>That is: find the value of a variable, referencing that variable by the
>means of a string with its name.
>
>  
>

-- 
 ..	Donald Major		"Tech Support..your Windows machine doesn't
dtm	SAS Institute Inc.	 work?  Have you tried installing a Macintosh?"
	Cary, NC 27513			- me          SAS - "The Power to Know"
	AKA "Ol' Baby Lee"






More information about the Squeak-dev mailing list