Steve Litt wrote:
> 
> I don't know for sure, because when I read about this stuff my first reaction 
> was "I'm not gonna do that!"
> 
> I got the impression I could do this:
> 
> myclass = MyClass.new
> myclass.never_seen_before_attribute = 5
> 
> As I said, I didn't research it because I considered its use to be a negative, 
> but stored it in the back of my mind in case I had to maintain code like 
> that.
> 

No, that is a little more dangerous.

Only a class that specifically supported that kind of behavior
would allow such a thing. See the 'ostruct' (OpenStruct)
library. Its author created it mostly as a toy, I think, but
it has been used in many situations. (I would not personally
suggest that *all* objects should behave that way.)

By the way, it's very instructive to look at the code for ostruct.


Hal