[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#46754: 28.0.50; Various map.el fixes and improvements
From: |
Stefan Monnier |
Subject: |
bug#46754: 28.0.50; Various map.el fixes and improvements |
Date: |
Mon, 01 Mar 2021 14:59:27 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> The attached patch for map.el and seq.el was initially motivated by the
> fact that (map--plist-p '(nil 1)) currently returns nil, whereas I'd
> expect an alist to begin with a cons.
>
> Along the way I noticed some other inconsistencies, such as map-do
> returning non-nil for alists, and the use of 5-arg alist-get when map.el
> expects Emacs 25; and edge cases such as an OBOE on arrays in
> map-delete.
>
> Throughout the patch I assume that cl-defgeneric is generally preferred
> over map--dispatch, except where some aspect of the latter can't be
> matched by the former, e.g. the use of advertised-calling-convention.
>
> WDYT?
Looks fine to me. I wouldn't advertise the default `map-insert`
implementation too much (especially not saying "it works for arrays and
hash-tables"), since its performance makes it undesirable (and it is
not specific to hash-tables nor arrays).
> -In the base definition, MAP can be an alist, hash-table, or array."
> +In the base definition, MAP can be a list, hash-table, or array."
A list isn't a map, so I think it would be better to write "alist/plist" or
somesuch to avoid giving the impression that lists can be treated as
maps in general.
Stefan
- bug#46754: 28.0.50; Various map.el fixes and improvements,
Stefan Monnier <=