From: Vladimir Zolotykh
Subject: Inheritance of slot options
Date: 
Message-ID: <opspqkqldt4w83rv@algow.eurocom.od.ua>
Hi

In the presence of CLOS inheritance, :initform option overrides and
:accessor, :initarg forms a union. What about :type option? For
example

   (defclass foo ()
     ((b :initform 0 :type integer :accessor foo-b)))

   (defclass bar (foo)
     ((b :initform 1))) ; [*]

May I count that slot B in BAR would inherit :TYPE from FOO, or I
should explicitly specify it there e.g (b :initform 1 :type integer) ?

Thanks in advance



-- 
Vladimir Zolotykh
From: Paul F. Dietz
Subject: Re: Inheritance of slot options
Date: 
Message-ID: <426B9924.1070302@dls.net>
Vladimir Zolotykh wrote:
> Hi
> 
> In the presence of CLOS inheritance, :initform option overrides and
> :accessor, :initarg forms a union. What about :type option? For
> example
> 
>   (defclass foo ()
>     ((b :initform 0 :type integer :accessor foo-b)))
> 
>   (defclass bar (foo)
>     ((b :initform 1))) ; [*]
> 
> May I count that slot B in BAR would inherit :TYPE from FOO, or I
> should explicitly specify it there e.g (b :initform 1 :type integer) ?


See section 7.5.3 of the CL standard.

Summary:  the type of the slot is the intersection of the types of
the slot specifiers in that class and its superclasses (a missing
type specifier defaults to the type T).

So, you don't have to explicitly specify the type of slot B in BAR.

	Paul