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

Martin Simmons <[email protected]> Mon, 18 May 2026 17:55:22 +0100
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
>>>>> On Sun, 17 May 2026 20:31:27 +0100, Tim Bradshaw (as tfb at cley dot com) said:
> 
> Because I think that it would be reasonable for a compiler to be able to
> assume that for, say
> 
> (locally (declare (type x a)) ... no assignment to a ...)
> 
> that a was in fact an x throughout.

Why can't the compiler assume that?  If the program breaks the assumption by
destructively modifying the object bound to a then that is a bug in the
program.  The same could happen for a cons:

(locally (declare (type (cons fixnum) a)) ...)

if you sneakily setf (car a) to something else.

> Also, pragmatically, the existence of change-class is one of (at least) two
> reasons why things like slot access is so horribly slow I am almost certain.

Yes, slot access in LispWorks takes a performance hit to guarantee
thread-safety for simultaneous change-class, but also for updating existing
objects after class redefinition.

-- 
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/

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