At Fri, 13 Oct 2000 12:10:02 +0900, Shugo Maeda <shugo / ruby-lang.org> wrote: > > I don't feel it's inconsistent (see `initialize'). It's a matter of > > choice. We can choose either a) make it public b) leave private with > > warning. > > I prefer b because I don't like implicit method visibility > changes. > How about others? I asked shugo a few questions on irc just now. it turns out that all private method which ends with `=' is effected with this syntax sugar. # i didn't know, i must be lucky ;P # He also told me that it might be possible if we check whether the # object respond to the method or not at run time, but we must check # all local variable assignment, and that _will_ cost us. e.g. class Foo def pub foo = 2 end private def foo=(x) p x end end Foo.new.pub doesn't work. (also Dave's already showed in [ruby-talk:5412]) that means private methods end with `=' is useless. so I just assume matz thought "if you can't use it as private method, make them public". I just think this is more like document issue rather than anything else. I was gonna vote for c) leave it as private with warning when -w Warning: "private method ending with `=' will conflict with assignment" with an entry for FAQ Q: Why a private method like `foo=' doesn't work? how can I make it work? A: Because it conflict with local variable assgnment statement. Running your script with switch `-w' gives you warnning. You can do either, rename the method without `=' at the end, or make it public. but... once you know setters will always be public, I can live with that without any problem. -- yashi