From: Yossef Mendelssohn Date: 2012-10-26T04:00:29+09:00 Subject: Re: Name/symbol/object type clash? What is happening here? --e89a8f3ba87ff1386904cce6d0cc Content-Type: text/plain; charset=ISO-8859-1 On Thu, Oct 25, 2012 at 12:25 PM, Igor Pirnovar 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 --e89a8f3ba87ff1386904cce6d0cc Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Thu, Oct 25, 2012 at 12:25 PM, Igor Pirnovar <lists@ruby-forum.com> wrote:
Robert Klemme wrote in post #1081146:

> I strongly object. =A0Struct 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 circum= stances, 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 &#= 39;Struct' should also be=A0discouraged

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

Just because somethin= g doesn't work the way you insist it must doesn't mean it's bro= ken.

--
-yossef
--e89a8f3ba87ff1386904cce6d0cc--