grabbing value of a variabe by its name?

Martin McClure martin at hand2mouse.com
Thu Jul 25 12:22:03 UTC 2002


At 1:42 PM +0200 7/25/02, Ragnar Hojland Espinosa wrote:
>foo _ 'hello'.
>bar _ 'world!'.
>baz _ #(foo bar).
>
>I can get the name of the var by a (baz at: 1), but how do i get its value?

The construct "#(foo bar)" specifies a literal Array that contains 
two literally-specified Symbols, #foo and #bar. It does not reference 
any variables.

One way to get what you're looking for is

baz _ Array with: foo with: bar.

-Martin



More information about the Squeak-dev mailing list