[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: map-put! and (setf (map-elt ...) ..) on lists
From: |
Nicolas Petton |
Subject: |
Re: map-put! and (setf (map-elt ...) ..) on lists |
Date: |
Mon, 17 Dec 2018 12:38:04 +0100 |
Stefan Monnier <address@hidden> writes:
Hi Stefan,
> The current handling of map-put on lists is very ad-hoc:
> The gv-expander of `map-elt` tests if the arg is a list and if so
> delegates to `alist-get`.
>
> It kind of works, but for a library that's supposed to be generic and
> expandable to other map types, this is undesirable.
>
> So in the patch below I change this such that `map-elt` does not special
> case lists any more. Instead `map-put!` is changed to signal a special
> error when it can't do its job, and the gv-expander of `map-elt` catches
> this error and delegates the job to a new non-side-effecting
> `map-insert`.
>
> With this, we can add new map types via defmethod that work like lists
> (i.e. that don't support inplace update but can still be modified via
> `setf`).
>
> WDYT?
I think it's a good step forward, thank you.
I'd like to start thinking about adding support for plists in map.el.
nico
signature.asc
Description: PGP signature
- RE: map-put! and (setf (map-elt ...) ..) on lists, (continued)
- RE: map-put! and (setf (map-elt ...) ..) on lists, Drew Adams, 2018/12/17
- RE: map-put! and (setf (map-elt ...) ..) on lists, Nicolas Petton, 2018/12/18
- RE: map-put! and (setf (map-elt ...) ..) on lists, Drew Adams, 2018/12/18
- Re: map-put! and (setf (map-elt ...) ..) on lists, Stefan Monnier, 2018/12/18
- RE: map-put! and (setf (map-elt ...) ..) on lists, Nicolas Petton, 2018/12/18
- RE: map-put! and (setf (map-elt ...) ..) on lists, Drew Adams, 2018/12/18
- RE: map-put! and (setf (map-elt ...) ..) on lists, Nicolas Petton, 2018/12/18
- Re: map-put! and (setf (map-elt ...) ..) on lists, Stefan Monnier, 2018/12/18
- RE: map-put! and (setf (map-elt ...) ..) on lists, Drew Adams, 2018/12/18
- Re: map-put! and (setf (map-elt ...) ..) on lists, Stefan Monnier, 2018/12/16
Re: map-put! and (setf (map-elt ...) ..) on lists,
Nicolas Petton <=