emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: User-defined record types, v2


From: Stefan Monnier
Subject: Re: User-defined record types, v2
Date: Sat, 18 Mar 2017 18:24:34 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

>>> +INLINE void
>>> +CHECK_RECORD_TYPE (Lisp_Object x)
>>> +{
>>> +  /* CHECK_SYMBOL (x); */
>>> +}
>> 
>> ???

> This is still a work in progress.  I initially added this function to
> check everywhere that the first slot is a valid defstruct type name.
> But then Stefan Monnier added support for EIEIO instances and made the
> first slot be a class object.

Right.  Currently the TYPE should be either a symbol (i.e. a "type
name"), or a `record` (a "type descriptor" aka "class") whose first
field (i.e. (aref type 1)) is a symbol.

But I'm not even sure we should enforce this in the `record` and
`make-record` primitives.  After all, it's not needed for safety.
And since we allow (aset <obj> 0 <foo>) we can circumvent this
check anyway.


        Stefan


PS: Of the two possible TYPEs, the `symbol' case is the least efficient,
so it'd be good to get rid of it, but the `record` case has an obvious
bootstrap problem if we force the TYPE to be a `record`.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]