Hal Fulton wrote:
> Robert Klemme wrote:
> 
>> 2006/2/12, Mark Volkmann <r.mark.volkmann / gmail.com>:> On 2/12/06, 
>> David Vallner <david / vallner.net> wrote:> > D Nede¥ªa 12 FebruáÓ 2006 
>> 20:45 Mark Volkmann napùÔal:> > > If Struct is a shorthand way for 
>> creating Classes, why don't objects> > > created from those Classes 
>> have instance_variables?
>>
>>> My issue is that I wanted to think of Struct as an alternate way of> 
>>> defining a class and that after doing so I could use it like any 
>>> other> class.
>>
>>
>> You can.
>>
> 
> Well, what if you want to add a new method to the class? That
> method should have the right to use the instance variables.

It does, if there are any.

> But in a Struct there aren't any.

Must a class have instance variables to be a 'real' class?

Why does the use of an array or hash, as the sole instance variable, 
seem (if I'm following this correctly) to disqualify a class as a 'real' 
class?

 From the outside, objects simply respond to messages. On the inside, 
they do stuff when sent a message.  Sometimes the outside and the inside 
match up (where you get the Ruby version of public properties), but 
there's no reason they *have* to, and no reason to assume it is the case.

  obj.foo=x

should not lead one to think that obj implements an instance var @foo.


-- 
James Britt