2012/4/5 Robert Klemme <shortcutter / googlemail.com>

> On Thu, Apr 5, 2012 at 4:33 PM, Bartosz Dziewo=F1ski <matma.rex / gmail.com=
>
> wrote:> Struct just does not have instance variables, which is surprising=
,
>
> I know - that's the whole point why "#instance_variables returns an
> empty list".  But the question was, whether this is the reason Hal
> calls them "unreal" - and whether it matters.  Both can probably only
> be answered by him since he coined the phrase...
>
> > if you assume that "Point =3D Struct :x, :y" is a shorthand for "class
> > Point; attr_accessor :x, :y; def initialize x, y; @x, @y =3D x, y; end;
> > end".
>
> Well, obviously it is not a shorthand for the code you show. :-)
> Still it doesn't explain why Hal calls them "unreal".  We are still
> only guessing as to what intentions his might have been.
>

Bartosz has understood my point. I don't mind that instance_variables
returns an empty list, but I have been annoyed at the difficulty or
impossibility
of reopening the class to add useful methods that manipulate the
instance data.

As a side issue, I wanted more flexible access to the members and more
freedom in creating classes and objects. (In general, I would rather say
obj.this.that than to say obj['this']['that'], and I'd like to freely
convert to
and from hashes.)

But of course, it is perfectly valid for anyone to say they don't like the
idea.
It would not be the first time I tried to solve a problem that many or most
others did not perceive at all.

Hal