From: Daniel Berger Date: 2007-01-19T07:45:07+09:00 Subject: Re: auto assign arguments? James Edward Gray II wrote: > On Jan 18, 2007, at 3:35 PM, Daniel Berger wrote: > > > Heck, why not > > take this a step further and create automatic getters and setters? You > > can always undef or redefine them. > > I would really be against that. If you do that, there's no point in > how Ruby currently has all instance data as private. It blows > encapsulation wide open and being very against the spirit of OO just > doesn't feel Rubyish to me. Hm, you're probably right. I suppose it would require some fundamental changes to the language, i.e. not allowing instance data to be set directly outside of the constructor (forcing you to use the actual getter and setter methods outside of the constructor). This is what Fortress does, and I think it's what Perl 6 will do as well. I'm not sure what the downside of that change would be, other than a forced method lookup. I don't know enough about Ruby internals to know if "@foo = 1" is cheaper than "foo = 1", but I'm guessing that it is. Forgive me, for I have been tainted by the Fortress language recently. :) Regards, Dan