From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: gmane.emacs.help Subject: Re: plists, alists, and hashtables Date: Sat, 08 Aug 2015 05:48:34 +0200 Organization: Informatimago Message-ID: <87r3nejv8t.fsf@kuiper.lan.informatimago.com> References: <876150vwaa.fsf@mbork.pl> <873803x5q4.fsf@kuiper.lan.informatimago.com> <87a8u7we9s.fsf_-_@lifelogs.com> <877fp8t9ru.fsf@lifelogs.com> <87lhdnsw2n.fsf@lifelogs.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1439005822 5725 80.91.229.3 (8 Aug 2015 03:50:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 8 Aug 2015 03:50:22 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 08 05:50:18 2015 Return-path: Envelope-to: geh-help-gnu-emacs@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 1ZNv9G-0007bx-69 for geh-help-gnu-emacs@m.gmane.org; Sat, 08 Aug 2015 05:50:18 +0200 Original-Received: from localhost ([::1]:51838 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNv9F-0002Yu-Ha for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Aug 2015 23:50:17 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 31 Original-X-Trace: individual.net xgTjCSCWQHj4/+BiMzs68w49jD4Sn0tUD/FbwmGeGCtNH1AZhG Cancel-Lock: sha1:ZmUxZGJkYmJmNTU5OTIzNjdiZDAzZmZlYmY4OWQwYzQxMzg5NTRmMg== sha1:7EylEmN/RENlg4PyCVzoSHUWyiw= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:214058 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:106343 Archived-At: Stefan Monnier writes: > I think what you're getting at is that (core) Lisp is somewhat > "untyped", so alists/plists can't be distinguished from other data built > using cons-cells: only the user knows whether that cons cells is meant > to be an alist or a plist or something else. This is a strawman argument. You can always wrap a-lists into a tagged type (a structure), and only touch it thru checked functions. This is what my dictionary abstraction does. Therefore you can prove that your a-list will never be ill-formed. This is useless, it's still more practical to use plain a-list, and not for the syntax, but for the very reason that you can process a plain a-list as if it wasn't an a-list and break the a-list invariant. If your programming process require a formal approach where you have the computer check your invariants, then be sure to wrap your a-lists in a structure and a functional abstraction that let you control it. Otherwise, you can use a-list directly, and syntactic suggar won't help, but on the contrary detract you from writing good code. -- __Pascal Bourguignon__ http://www.informatimago.com/ “The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment.” -- Carl Bass CEO Autodesk