From: Sam Steingold
Subject: history of the standard
Date:
Message-ID: <ufz0l5oc9.fsf@gnu.org>
why can typed structs and classes of the same name coexist?
(progn
(defstruct (foo (:type vector)))
(defclass foo () ())
(list (make-foo) (make-instance 'foo)))
the standard specifies that the above must be legal.
--
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
If at first you don't suck seed, try and suck another seed.
Sam Steingold wrote:
> why can typed structs and classes of the same name coexist?
>
> (progn
> (defstruct (foo (:type vector)))
> (defclass foo () ())
> (list (make-foo) (make-instance 'foo)))
>
> the standard specifies that the above must be legal.
I'm not so sure about that: The MAKE-FOO function may well use the
definition of FOO as a type established by DEFSTRUCT. But this definition
of FOO is replaced by the DEFCLASS form, before MAKE-FOO is called.
Bruno
From: Christophe Rhodes
Subject: Re: history of the standard
Date:
Message-ID: <sqllad6zmv.fsf@cam.ac.uk>
Bruno Haible <·····@clisp.org> writes:
> Sam Steingold wrote:
>> (progn
>> (defstruct (foo (:type vector)))
>> (defclass foo () ())
>> (list (make-foo) (make-instance 'foo)))
>>
>> the standard specifies that the above must be legal.
>
> I'm not so sure about that: The MAKE-FOO function may well use the
> definition of FOO as a type established by DEFSTRUCT. But this definition
> of FOO is replaced by the DEFCLASS form, before MAKE-FOO is called.
(defstruct (foo (:type vector))) does not establish a type named FOO,
though. I agree with Sam that his code is legal.
Christophe
Christophe Rhodes wrote:
> (defstruct (foo (:type vector))) does not establish a type named FOO,
> though. I agree with Sam that his code is legal.
Yes. You are right.
Bruno