From: "RadosÅ‚aw BuÅ‚at" Date: 2008-03-28T07:40:57+09:00 Subject: Re: instance_variable_[gs]et On Thu, Mar 27, 2008 at 9:07 PM, Joel VanderWerf wrote: > I've got a couple of methods in library code I use frequently that > initialize or populate an object from a hash using the loop above. I've > always thought it was kind of a pain (and inefficient) to have to > construct a string for each key. Does it mean that everyone use/need it? I don't think so. > Why couldn't #instance_variable_set be agnostic about whether you refer > to ivars as "foo" or "@foo" ? I don't see any ambiguity... I don't know if it's main reason but AFAIR Ruby internally use instance variables without "@" character to store additional information about object (but from Ruby you can't get it). I think that most important is consistent. We use @ in code and the same goes when we want get value by instance_variable_get method. -- Rados³aw Bu³at http://radarek.jogger.pl - mój blog