From: dblack@... Date: 2003-02-17T06:54:17+09:00 Subject: Re: General programming language question Hi -- On Mon, 17 Feb 2003, Ryan Pavlik wrote: > On Mon, 17 Feb 2003 02:35:05 +0900 > "Chris Pine" wrote: > > What would be another way? I don't know... I was thinking of > > something like "variables as one-element hashes"... but of course you > > need a variable to refer to the array, so we gained nothing. > > Well, Smalltalk uses a Dictionary, I believe, to map variables to their > values, and there's no reason you can't make a language do similar. > With Ruby, you can get a Binding and evaluate things inside it. I'm > rooting for the ability to do something like this: > > varstr = "myvarname" > sym = varstr.intern # => :myvarname > sym.bind(42) > > p myvarname # => 42 > > The only thing you can't currently do is the sym.bind() deal from Ruby. > (Doing it on the C side is easy.) So basically you've got your > first-class variables. Or even just: varstr = "myvarname" varstr.bind(42) since the Symbol object is really just serving as a (probably faster) string representation. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav