unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] scratch/record 25aa500 5/5: Backward compatibility with pre-existing struct instances.
       [not found] ` <20170328192617.32EF32017F@vcs0.savannah.gnu.org>
@ 2017-03-28 20:47   ` Stefan Monnier
  2017-03-29  6:52     ` Lars Brinkhoff
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2017-03-28 20:47 UTC (permalink / raw)
  To: emacs-devel

> --- a/lisp/emacs-lisp/cl-preloaded.el
> +++ b/lisp/emacs-lisp/cl-preloaded.el
> @@ -79,6 +79,8 @@
>          (let ((tag (intern (format "cl-struct-%s" name)))
>                (type-and-named (get name 'cl-struct-type))
>                (descs (get name 'cl-struct-slots)))
> +          (if (null (car type-and-named))
> +              (setq type-and-named (cons 'record (cdr type-and-named))))
>            (cl-struct-define name nil (get name 'cl-struct-include)
>                              (unless (and (eq (car type-and-named) 'vector)
>                                           (null (cadr type-and-named))

Hmm... if we're in this code, it means we're in the case of an old-old
struct (once compiled before we introduced cl-struct-define), so it's
definitely not using `record`s.


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Emacs-diffs] scratch/record 25aa500 5/5: Backward compatibility with pre-existing struct instances.
  2017-03-28 20:47   ` [Emacs-diffs] scratch/record 25aa500 5/5: Backward compatibility with pre-existing struct instances Stefan Monnier
@ 2017-03-29  6:52     ` Lars Brinkhoff
  2017-03-29 12:26       ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Brinkhoff @ 2017-03-29  6:52 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
>>          (let ((tag (intern (format "cl-struct-%s" name)))
>>                (type-and-named (get name 'cl-struct-type))
>>                (descs (get name 'cl-struct-slots)))
>> +          (if (null (car type-and-named))
>> +              (setq type-and-named (cons 'record (cdr type-and-named))))
>>            (cl-struct-define name nil (get name 'cl-struct-include)
>>                              (unless (and (eq (car type-and-named) 'vector)
>>                                           (null (cadr type-and-named))
>
> Hmm... if we're in this code, it means we're in the case of an old-old
> struct (once compiled before we introduced cl-struct-define), so it's
> definitely not using `record`s.

Good, I'll remove that code.


There's also a lingering FIXME that you added:

 (cl-defstruct (eieio--object
-               (:type vector)           ;We manage our own tagging system.
+               (:type vector) ;; FIXME!  ;We manage our own tagging system.
                (:constructor nil)

As far as I can see, the struct isn't used directly.  These definitions
are derived from it: eieio--object-class-tag, eieio--object-class-tag,
and eieio--object-num-slot.  The first two just aref slot 0, and the
second is 1.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Emacs-diffs] scratch/record 25aa500 5/5: Backward compatibility with pre-existing struct instances.
  2017-03-29  6:52     ` Lars Brinkhoff
@ 2017-03-29 12:26       ` Stefan Monnier
  2017-03-29 17:18         ` Lars Brinkhoff
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2017-03-29 12:26 UTC (permalink / raw)
  To: emacs-devel

> There's also a lingering FIXME that you added:
>
>  (cl-defstruct (eieio--object
> -               (:type vector)           ;We manage our own tagging system.
> +               (:type vector) ;; FIXME!  ;We manage our own tagging system.
>                 (:constructor nil)
>
> As far as I can see, the struct isn't used directly.

Indeed, which is why it works despite the inconsistency.

> These definitions are derived from it: eieio--object-class-tag, and
> eieio--object-num-slot.  The first just aref slot 0, and the second is 1.

That's right.  I put a FIXME because this inconsistency is ugly.
I'm not completely sure how best to fix it, tho.  Maybe just define
those two accessors by hand.


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Emacs-diffs] scratch/record 25aa500 5/5: Backward compatibility with pre-existing struct instances.
  2017-03-29 12:26       ` Stefan Monnier
@ 2017-03-29 17:18         ` Lars Brinkhoff
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Brinkhoff @ 2017-03-29 17:18 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> As far as I can see, the struct isn't used directly.  These
>> definitions are derived from it: eieio--object-class-tag, and
>> eieio--object-num-slot.  The first just aref slot 0, and the second
>> is 1.
>
> That's right.  I put a FIXME because this inconsistency is ugly.
> I'm not completely sure how best to fix it, tho.  Maybe just define
> those two accessors by hand.

I did that now.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-29 17:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20170328192614.13038.29393@vcs0.savannah.gnu.org>
     [not found] ` <20170328192617.32EF32017F@vcs0.savannah.gnu.org>
2017-03-28 20:47   ` [Emacs-diffs] scratch/record 25aa500 5/5: Backward compatibility with pre-existing struct instances Stefan Monnier
2017-03-29  6:52     ` Lars Brinkhoff
2017-03-29 12:26       ` Stefan Monnier
2017-03-29 17:18         ` Lars Brinkhoff

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).