emacs-devel
[Top][All Lists]
Advanced

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

Re: plist-based package.el (was Re: cl-defstruct-based package.el, now w


From: Ted Zlatanov
Subject: Re: plist-based package.el (was Re: cl-defstruct-based package.el, now with ert tests and no external tar!)
Date: Wed, 05 Jun 2013 10:53:00 -0400
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux)

On Wed, 05 Jun 2013 03:01:47 +0400 Dmitry Gutov <address@hidden> wrote: 

DG> On 05.06.2013 2:44, Daniel Hackney wrote:
>> The big problem with `cl-defstruct' in this case is its lack of
>> extensibility. We are going to want to add additional slots to
>> `package-desc' structures over time, but doing so would require
>> redefining `package-desc' each time.  `cl-defstruct' requires that
>> structures be of the exact length given in the definition of the
>> structure

DG> I haven't had the time to read your patch properly yet, but I don't
DG> think that's necessarily true. Just like I did in my current patch for
DG> #13291, one of the fields in the struct can contain an alist with all
DG> extra properties.

I agree with Dmitry.  Keep the top-level structure static with
`cl-defstruct' and just add an option field that holds a plist.  That
provides a good data API, while a pure-plist approach is inherently less
stable as an API.

I worked with plist-only data structures in auth-source.el and looking
back, wish I had used the approach suggested by Dmitry and kept plists
to just one corner of the data structure.  Emacs Lisp doesn't have
(AFAIK) good plist support and self-quoting symbols have some issues
too, so you may end up converting 'X to :X and back occasionally.  That
was just my experience and I may have simply used plists badly.

To address all this I used some `loop' tricks... it seemed like a good
idea at the time :)

Ted




reply via email to

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