Traits vs interfaces and a trivial idea (was Re: Future of smalltalk (was Re: election details *PLEASE READ*))

Andreas Raab andreas.raab at gmx.de
Fri Feb 23 07:52:52 UTC 2007


Göran Krampe wrote:
> I would be more interested in "late" binding where I could do:
> 
>    someThingy respondsToProtocol: aProtocol
> 
> ...where aProtocol is more or less just a bunch of selectors. The main
> difference is of course that the class (or any of its superclasses) of
> someThingy doesn't need to *declare* that it implements aProtocol - it
> just has to actually do it. :)

Funny you should mention this. I had the same idea a while ago but the 
trouble is that you want a really, REALLY fast check (as fast as isFoo 
effectively so that you can say: "true isA: Boolean" and be that the 
speedy equivalent of "true isBoolean") and to do this you need some way 
of caching the result effectively (and invalidate it as the class 
changes). Alas, I could never come up with a scheme that was as fast as 
I needed it to be (if you have any ideas, I'm all ears).

Cheers,
   - Andreas



More information about the Squeak-dev mailing list