all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: master b0eb668 2/2: * lisp/emacs-lisp/map.el (map--dispatch): Move before use.
       [not found] ` <E1Z0yIF-00042r-8u@vcs.savannah.gnu.org>
@ 2015-06-05 22:38   ` Nicolas Petton
  0 siblings, 0 replies; only message in thread
From: Nicolas Petton @ 2015-06-05 22:38 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-diffs, emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 1148 bytes --]


Glenn Morris writes:

> branch: master
> commit b0eb66823f12c85d04e36ddd0e58e20c0a0694db
> Author: Glenn Morris <rgm@gnu.org>
> Commit: Glenn Morris <rgm@gnu.org>
>
>     * 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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 512 bytes --]



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-05 22:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20150605203242.15469.7882@vcs.savannah.gnu.org>
     [not found] ` <E1Z0yIF-00042r-8u@vcs.savannah.gnu.org>
2015-06-05 22:38   ` master b0eb668 2/2: * lisp/emacs-lisp/map.el (map--dispatch): Move before use Nicolas Petton

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.