[Openmcl-devel] Is this a bug? defstruct :type option

Gary Byers gb at clozure.com
Tue Dec 7 22:56:16 UTC 2004



On Tue, 7 Dec 2004, Raffael Cavallaro wrote:

> In OpenMCL:
>
> ? (defstruct (v3 (:type (vector double-float 3)))
>                 x y z)
>  > Error in process listener(1): Bad defstruct option (:TYPE (VECTOR
> DOUBLE-FLOAT 3)).
>  > While executing: DEFSTRUCT
>  > Type :POP to abort.
> Type :? for other options.
>
>
> In sbcl:
>
> * (defstruct (v3 (:type (vector double-float 3)))
>                 x y z)
>
> debugger invoked on a SB-KERNEL::ARG-COUNT-ERROR in thread 10167:
>    error while parsing arguments to DESTRUCTURING-BIND:
>      invalid number of elements in
>        (VECTOR DOUBLE-FLOAT 3)
>      to satisfy lambda list
>        (VECTOR SB-KERNEL::VTYPE):
>      exactly 2 expected, but 3 found
>
> You can type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
>
> restarts (invokable by number or by possibly-abbreviated name):
>    0: [ABORT   ] Reduce debugger level (leaving debugger, returning to
> toplevel).
>    1: [TOPLEVEL] Restart at toplevel READ/EVAL/PRINT loop.
> (SB-KERNEL::PARSE-1-DD-OPTION
>   2
>   (:TYPE (VECTOR DOUBLE-FLOAT 3))
>   #<SB-KERNEL:DEFSTRUCT-DESCRIPTION V3>)[:EXTERNAL]
> 0]
>
>
> However, clisp and LispWorks (Mac OS X) handle this defstruct type
> option just fine.
>
> Is this a valid type specifier for defstruct?

Yes, it is (so the complaint is misguided.) Aside from the fact that
the parser isn't handling this, there may be runtime support that
assumes that (:TYPE VECTOR) means (:TYPE (VECTOR T))

>
> regards,
>
> Ralph
>
> Raffael Cavallaro, Ph.D.
> raffaelcavallaro at mac.com



More information about the Openmcl-devel mailing list