On Thu, Oct 25, 2012 at 12:25 PM, Igor Pirnovar <[email protected]>wrote:

> Robert Klemme wrote in post #1081146:
>
> > I strongly object.  Struct is a very useful tool I use all the time to
> > define data containers quickly.
>
> >> The above problem can be solved if you use accessor methods in place of
> >> '@' variable:
> >
> > Exactly.
>
> I have no objection if anybody wishes to use the broken Struct as it is
> in his/her own short-cuts and sketches. However, if allowed there, who
> is going to prevent its use in main-stream programming? The trouble is,
> this stuff is so broken in situations becomes totally useless. Its
> inconsistencies with regular ruby classes make things unacceptable on
> the first place, and I can not believe anyone would defend its
> continuous usage in this broken fashion! If it is so bloody useful, fix
> the darn thing so it doesn't introduce unnecessary exceptions to the
> impeccable consistent and beautiful Ruby oo language!
>

You yourself said

> However, except in limited initialization circumstances, the use of '@'
> variables should be prohibited, and from the point of view of strict
> OOP, it is, by convention!

However, you went on to say

> The use of 'Struct' should also be discouraged

which is where we differ. I much prefer to discourage the use of ivars ('@'
variables, or "instance variables") and stick to the object contract/API
internally. I use Struct in production code because it's fabulously useful.

Just because something doesn't work the way you insist it must doesn't mean
it's broken.

-- 
-yossef

-- You received this message because you are subscribed to the Google Groups 
ruby-talk-google group. To post to this group, send email to 
[email protected]. To unsubscribe from this group, send email 
to [email protected]. For more options, visit this 
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en

Reply via email to