[Prev][Next][Index][Thread]

Re: Need help with Class-Allocated Slots



Lyman Taylor <lyman.taylor@mindspring.com> wrote:
> Neel Krishnaswami wrote:
> ....
> > The big problems with this that is it's hard to know what to do if
> > there is a specialized method shadowing the basic getter. For example:
> 
>   What if there were a way to add to generic function the same method
>   so that instance and class access use the same method? 

Then you'd need to rethink the (lack of) distinction between slots and
methods, which is IMO probably a bad idea, or at least a sign that this
should be accomplished with a more general good idea.
 
> >  define method foo (obj :: <perverse-subclass>, #next next-method)
> >    obj.bar * next-method()
> >  end method;
> 
> By the way, I'm not sure it is a good idea to allow this to be legal
> (unless "bar" is also a class slot). If you can access a class slot
> without any instances the above is nonsensical. The compiler may be
> able to flag it as such but it would be a runtime error.

I think it's a splendid idea for this remain legal, which is why I'm
so dubious about the idea of making class slots accessible without an
instance. :)


Neel



References: