From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: Replacement for `aput' from obsolete assoc.el? Date: Sat, 9 Jun 2012 09:11:24 -0700 Message-ID: <2B4A444C5CD5486DA0403B9E6B99F37D@us.oracle.com> References: <87txyrnhxi.fsf@web.de> <87oboytp45@ch.ristopher.com> <87haupwo6b.fsf@web.de><871ulq44oj.fsf@gmail.com> <87pq9a7zab.fsf@uwakimon.sk.tsukuba.ac.jp><87mx4c97za.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1339258302 3706 80.91.229.3 (9 Jun 2012 16:11:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 9 Jun 2012 16:11:42 +0000 (UTC) Cc: emacs-devel@gnu.org To: "'Stephen J. Turnbull'" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jun 09 18:11:42 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SdOGL-0007Ch-AR for ged-emacs-devel@m.gmane.org; Sat, 09 Jun 2012 18:11:41 +0200 Original-Received: from localhost ([::1]:50043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdOGL-00014s-3u for ged-emacs-devel@m.gmane.org; Sat, 09 Jun 2012 12:11:41 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdOGI-00014h-P1 for emacs-devel@gnu.org; Sat, 09 Jun 2012 12:11:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SdOGH-0001Fv-1r for emacs-devel@gnu.org; Sat, 09 Jun 2012 12:11:38 -0400 Original-Received: from acsinet15.oracle.com ([141.146.126.227]:37175) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdOGG-0001FX-Ro for emacs-devel@gnu.org; Sat, 09 Jun 2012 12:11:36 -0400 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q59GBX9K016174 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 9 Jun 2012 16:11:33 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q59GBW8p002090 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 9 Jun 2012 16:11:33 GMT Original-Received: from abhmt101.oracle.com (abhmt101.oracle.com [141.146.116.53]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q59GBWwi016927; Sat, 9 Jun 2012 11:11:32 -0500 Original-Received: from dradamslap1 (/10.159.219.243) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 09 Jun 2012 09:11:32 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac1GJMyoZg+GEfxqRdiarixATO2W5wALlzjQ X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 141.146.126.227 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:150861 Archived-At: Alists and plists each have their advantages. The main difference is mentioned in (elisp) `Plists and Alists': In contrast to association lists, the order of the pairs in the property list is not significant since the property names must be distinct. That gives alists the ability to shadow associations. An association list may be used like a stack where associations are pushed on the front of the list and later discarded... And it means that: All properties for a symbol are stored in the same property list, so there is a possibility of a conflict between different uses of a property name. [But sure, you could use a plist as a stack, with shadowing, by defining your own accessor etc. It's just a list, after all. But `plist-get' and `get' do not act that way.] The advantage for plists pointed out in that doc section is that plists are what you get with symbols - they are built in. It contrasts a global alist with the plists associated with individual symbols. [But that's just the way things are designed. Lisp could be/have been designed with individual symbols having asssociated alists instead of plists.] Here is another typical difference (from (elisp) `Association Lists'): Both the values and the keys in an alist may be any Lisp objects. For example, in the following alist, the symbol `a' is associated with the number `1', and the string `"b"' is associated with the _list_ `(2 3)', which is the CDR of the alist element: ((a . 1) ("b" 2 3)) [But again, a plist too could use anything as a key, provided you roll your own accessor. But `plist-get' and `get' use `eq' comparison.] In short, each is just a list; each is general enough to replace the other. But to do so means going beyond the usual accessors etc. And in the case of symbol properties it would require a different Lisp implementation (or some indirection hack).