[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master b0eb668 2/2: * lisp/emacs-lisp/map.el (map--dis
From: |
Nicolas Petton |
Subject: |
Re: [Emacs-diffs] master b0eb668 2/2: * lisp/emacs-lisp/map.el (map--dispatch): Move before use. |
Date: |
Sat, 06 Jun 2015 00:38:50 +0200 |
Glenn Morris writes:
> branch: master
> commit b0eb66823f12c85d04e36ddd0e58e20c0a0694db
> Author: Glenn Morris <address@hidden>
> Commit: Glenn Morris <address@hidden>
>
> * lisp/emacs-lisp/map.el (map--dispatch): Move before use.
There is still an issue with the byte compiler and `map-put' (it could
also happen with `map-delete'): in case of a list, a symbol has to be
used since `map-put' internally uses `setq' to mutate the map:
(map-put mylist :b 2) ;; This is fine
(map-put '((:a . 1)) :b 2) ;; This is not ok
While it works fine with other maps (where setq is not used):
(map-put [a b c] 0 d) ;; This is fine, but the byte compiler will complain
The macro is using `map--dispatch' to evaluate the correct form based on
the type of the map, and while *I* know that `setq' will only be used if
`map' is a list, the byte compiler doesn't seem to know that, and throws
an error.
Wrapping the call to `setq' in an `if' form to check if `map' is a
symbol could maybe fix the issue, but I was wondering if there was a
better solution.
Cheers,
Nico
--
Nicolas Petton
http://nicolas-petton.fr
signature.asc
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Emacs-diffs] master b0eb668 2/2: * lisp/emacs-lisp/map.el (map--dispatch): Move before use.,
Nicolas Petton <=