[plt-scheme] applying set! on the contents of a variable

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Sat Sep 29 14:37:15 EDT 2007


Variable names cannot be passed around as first-class objects.
However, I can think of a few ways you can work with this.  One, if
you need to update a set of names to be passed around dynamically, you
could set up a hash table instead of using separate variables.  Two,
instead of storing symbols as your keys, you could store getter/setter
functions for the variables.  Three, you could always write a
hard-coded getter/setter function that uses 'case' to match symbols to
known variable names.  In general, though, variable names are not

I hope this helps.


On 9/29/07, harsha <harsha.v.r at gmail.com> wrote:
> how does one change a variable whose symbol is stored in another
> variable?
>  sorry about the beginner question, but i couldn't find an answer in
> the group discussions or on google.
>  the reason i need this came up was because i have a function inside a
> class which takes as input an alist of properties and values and
> changes the current values in the class using this alist. i have a
> workaround, but was curious as to whether variable names could be
> treated as first-class objects.

Carl Eastlund

Posted on the users mailing list.