[Openmcl-devel] (SETF FIND-CLASS)

Gary Byers gb at clozure.com
Tue May 5 05:25:35 PDT 2009


? (class-name (find-class 'bar))
FOO

See the glossary entry for "proper name" in CLHS.

See also
<http://clozure.com/pipermail/openmcl-devel/2008-November/008695.html>
which seems to be full of typos but is hopefully intelligible.

If C is a class and S is a symbol, then I think that the spec says that
the effect of

(setf (find-class s) c)

is to define S to be a type specifier (equivalent to C) if and only if

(eq (class-name c) s)

is also true;  (SETF FIND-CLASS) checks for this in CCL and only defines
S as a type specifier in that case.

This interpretation seems pretty clear to me.  (I'm willing to believe
that there's something in the spec that contradicts that interpretation,
but I can't find it and the preponderance of the evidence seems to support
this interpretation.)  All well and good, but it seems that many (most ?
all ?) other implementations unconditionally define S to be a type-specifier
whenever C is a class, and it may be true that most people expect this
behavior.

As noted in the earlier message, CCL's behavior would be more consistent
if DEFTYPE also checked for proper-namedness (or the equivalent).




--On May 5, 2009 1:03:47 PM +0200 "Leslie P. Polzer" 
<sky at viridian-project.de> wrote:

>
> I just noticed that CCL doesn't seem to register class aliases
> as types:
>
> ? (defclass foo nil nil)
># <STANDARD-CLASS FOO>
> ? (typep 5 'foo)
> NIL
> ? (setf (find-class 'bar) (find-class 'foo))
># <STANDARD-CLASS FOO>
> ? (typep 5 'bar)
>> Error: Unknown type specifier: BAR
>
> But the spec (FIND-CLASS) says:
>
>   Returns the class object named by the symbol in the environment.
>
> And in section 4.3.7, "Integrating Types and Classes":
>
>   Every class that has a proper name has a corresponding type
>   with the same name.
>
> This seems to be a pretty clear case to me, but I may be
> convinced of the converse. :)
>
>   Leslie
>
> --
> http://www.linkedin.com/in/polzer
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>







More information about the Openmcl-devel mailing list