List Recv
6/26/2006 3:51:00 AM
I think it is an issue of implenetation versus intention.
Implementation wise, it makes sense. Class methods aren't to be viewed
as static methods of the class - they're methods of a different class,
of class Class.
Intention wise - it seems wrong to me. I should be able to mark
methods as not being part of the public interface, but usable in
constructors and other "static" methods.
Reminds me of the ol' Unix
you-can-delete-a-file-that-you-don't-have-write-permissions-to paradox.
Looking at the implementation, you can understand this (deleting a
file is not writing to it but rather to its directory). Intention
wise, it's wrong. What surprises me is that Ruby seems to go with the
OO theme of focusing on intention, not implementation.
My 2 cents.
zycte wrote:
> On 2006-06-23 13:59:38 +0200, "Austin Ziegler" <halostatue@gmail.com> said:
>
> > listrecv@gmail.com wrote:
> >> All these techniques are hackish, in that you need to set up an access
> >> control means and break it.
> >>
> >> Is there no way to mark a method as "may be called by the instance as
> >> well as by class methods"?
> >
> > No. Because "class methods" aren't what you think they are.
>
> To be more specific, a class is just an object, which also follows
> normal access control (public: everyone, private: me only, protected:
> descendants)
>
> Although this is very consequent, it makes it sometimes a pain, like in
> your example. I also ran into this issue a while ago, I decided just to
> go public with one helper initializer and by documenting it as private
> in the API.
>
> >
> > You could have a flag in your class that would prevent the calling of
> > the initialization method more than once.
> >
> > -austin