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: Thu, 06 Jun 2013 08:51:06 -0400
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux)

On Thu, 06 Jun 2013 18:30:11 +0900 "Stephen J. Turnbull" <address@hidden> 
wrote: 

SJT> Ted Zlatanov writes:
>> plists as a sequence of odd=key and even=value don't actually associate
>> the key with the value, unlike hashtables and alists.

SJT> They do if you use plist-put and plist-get.  If you use list
SJT> primitives, you get what you deserve, which may not always be what you
SJT> want....

The association is positional.  All you have to do is insert an element
in the middle of the list and the plist is broken.  Also there's no
iteration primitive, so you have to use something like

#+begin_src lisp
         (setq keys (loop for i below (length spec) by 2
                     collect (nth i spec)))
#+end_src

By contrast, an alist is an actual list of association cells that works
with `mapcar', and a hashtable is opaque so you don't know or care how
the association is maintained, but you can't screw it up.

Ted




reply via email to

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