Re: MOP question for language lawyers: can you specialize on standard-class

"Tim Bradshaw (as tfb at tfeb dot org)" <[email protected]> Tue, 21 Apr 2026 18:40:37 +0100
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
On 21 Apr 2026, at 18:09, Martin Simmons <[email protected]> wrote:
> 
> Yes, I don't see why not.  In fact, I think you have to specialize on the
> class argument if you don't have a specific metaclass because otherwise the
> AMOP method that specializes on standard-class (and doesn't specialize on
> object) will be the most applicable method and your method will never be
> called.

Yes, I think you have to specialize on the class as you say.  I was wondering if you were required to define a subclass of standard-class rather than standard-class itself to specialize on.

> What are your concerns about it?

I think that if you were required to subclass standard-class, then implementations could know that, for objects whose metaclass was standard-class, it is safe to short-circuit slot access (I know LW has an approach to this).

I don't think that's a very good situation (although it's better than 'all bets are off'), because it puts you in what I think of as the scripting-language situation, where things whose metaclass is standard-class can be really quick, but the moment you define your own metaclass, nothing can ever be that quick.  So in that sense LW's answer is better.

--tim

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html