From: "Hal E. Fulton" Date: 2001-10-23T04:47:29+09:00 Subject: [ruby-talk:22993] Re: assigning variables ----- Original Message ----- From: Joseph McDonald To: ruby-talk ML Sent: Monday, October 22, 2001 2:42 PM Subject: [ruby-talk:22992] Re: assigning variables > > HEF> I don't get *why* you want to do this... could you > HEF> just use an array of arrays? > > It's for a templating type application. I want to be able to name the > variables that go in. I just used arrays as an example. I'd like to > be able to pass any sort of object in, along with the name that object > will be referenced as. Could you possibly just keep it as a hash? Not refer to a and b but vars["a"] and vars["b"]? One problem, I think, is that eval can't create a new local variable. (It can, but only within the context of the eval -- it won't be defined when you return.) Would it be practical to make these instance variables, i.e., @a, @b, etc.? Or, heaven help us, globals? Hal