grabbing value of a variabe by its name?
Ragnar Hojland Espinosa
ragnar at linalco.com
Thu Jul 25 13:28:10 UTC 2002
On Thu, Jul 25, 2002 at 07:22:03AM -0500, Martin McClure wrote:
> 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.
Uhh, i dont see how.. please elaborate a bit. The following would work, but
it saves nothing.
baz _ at: 'foo' put: foo.
baz _ at: 'bar' put: bar.
--
Ragnar Hojland - Project Manager
Linalco "Especialistas Linux y en Software Libre"
Tel: +34-91-5970074 Fax: +34-91-5970083
More information about the Squeak-dev
mailing list
|