[Top][All Lists]

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

Re: plists, alists, and hashtables

From: Pascal J. Bourguignon
Subject: Re: plists, alists, and hashtables
Date: Sat, 08 Aug 2015 05:48:34 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Stefan Monnier <address@hidden> 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

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__       
“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

reply via email to

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