From: John Joyce Date: 2007-05-06T20:45:22+09:00 Subject: Re: How can I output an object/variable's name? On May 6, 2007, at 7:39 PM, Robert Dober wrote: > > However John I still fail to see why you were happy with "eval" why > would you need it? > If you feel the need for eval in this context it is for 99% wrong, > maybe we can help you better if you describe a little bit more of your > needs. > > Maybe all you need are objects with a name property and maybe it would > be best to use a different name (see how the two levels that > designation can be used might become *very* confusing) like e.g. > how_I_call_this_object (that is an extreme example of course). > > Cheers > Robert Well, exactly all I want to do is to be able to take a set of objects, and then list them by the name or reference (the one used in program code) then list them and their contents. I don't really need to do it. I just was kind of wondering if it was really possible or practical, but it seems to not be. example would be: class Person attr_accessor :name some other attributes ... end p1 = Person.new p1.name = "Mickey Mouse" So I'd like to generate a list like so: p1 Mickey Mouse, attribute, attribute, ... p2 attribute, attribute, ... .... maybe it's not necessary to do this. I want the instance's name (like p1 here) to be accessible and manipulatable like an attribute as well.