unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <87fvwvwgg5.fsf@lifelogs.com> (raw)
In-Reply-To: 87r4gfa8nw.fsf@uwakimon.sk.tsukuba.ac.jp

On Thu, 06 Jun 2013 18:30:11 +0900 "Stephen J. Turnbull" <stephen@xemacs.org> 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	other threads:[~2013-06-06 12:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-04 22:44 plist-based package.el (was Re: cl-defstruct-based package.el, now with ert tests and no external tar!) Daniel Hackney
2013-06-04 23:01 ` Dmitry Gutov
2013-06-05 14:53   ` Ted Zlatanov
2013-06-05 17:41     ` Stefan Monnier
2013-06-05 17:56       ` Drew Adams
2013-06-05 18:06         ` Ted Zlatanov
2013-06-06  9:30           ` Stephen J. Turnbull
2013-06-06 12:51             ` Ted Zlatanov [this message]
2013-06-07  3:07               ` Stephen J. Turnbull
2013-06-07 13:03                 ` opaque data types (was: plist-based package.el (was Re: cl-defstruct-based package.el, now with ert tests and no external tar!)) Ted Zlatanov
2013-06-07 13:27                   ` opaque data types Christopher Schmidt
2013-06-07 14:11                     ` Ted Zlatanov
2013-06-07 15:44                       ` Christopher Schmidt
2013-06-07 16:01                         ` Ted Zlatanov
2013-06-08  9:19                           ` Christopher Schmidt
2013-06-10  3:56                             ` Ted Zlatanov
2013-06-07 16:17                   ` Stefan Monnier
2013-06-07 17:48                     ` Ted Zlatanov
2013-06-08  6:11                   ` Stephen J. Turnbull
2013-06-08  6:28                   ` opaque data types [revise and resend] Stephen J. Turnbull
2013-06-10  4:00                     ` Ted Zlatanov
2013-06-05  1:34 ` plist-based package.el (was Re: cl-defstruct-based package.el, now with ert tests and no external tar!) Stefan Monnier
2013-06-06  1:31   ` Daniel Hackney
2013-06-08  6:47     ` Rand User

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fvwvwgg5.fsf@lifelogs.com \
    --to=tzz@lifelogs.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).