unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Sho Takemori <stakemorii@gmail.com>
To: Nicolas Petton <nicolas@petton.fr>
Cc: 23105@debbugs.gnu.org
Subject: bug#23105: 25.0.92; map-put does not change its argument MAP
Date: Sat, 26 Mar 2016 00:20:49 +0900	[thread overview]
Message-ID: <CAHbQ=cWFPzD3vpvaPKCQ5YMCBSHvW-aV2EaBGdmwWWfXmYbMoA@mail.gmail.com> (raw)
In-Reply-To: <871t6yoaho.fsf@petton.fr>

[-- Attachment #1: Type: text/plain, Size: 769 bytes --]

OK. Thanks for the reply.


2016-03-26 0:14 GMT+09:00 Nicolas Petton <nicolas@petton.fr>:

> Sho Takemori <stakemorii@gmail.com> writes:
>
> > Thanks for the fix. But after the fix, if MAP is a list literal, then it
> > raises an error.
> > For example, this raises an error.
> > (map-put '((a . 1)) 'a "value")
> >
> > This works.
> > (map-put [0 1 2] 1 "value")
> >
> > It is an expected error?
>
> Yes, in the sense that the same error will be raised if you try to do it
> with a setf on an alist:
>
> (setf (alist-get 'b '((a . 1))) 3) ;; => invalid-function (a . 1)
>
> (let ((alist '((a . 1))))
>   (setf (alist-get 'b alist) 3)) ;; => works fine
>
> Note however that mutating literal lists is in general not a good idea,
> as conses might be shared.
>
> Nico
>

[-- Attachment #2: Type: text/html, Size: 1299 bytes --]

  reply	other threads:[~2016-03-25 15:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-24 12:09 bug#23105: 25.0.92; map-put does not change its argument MAP Sho Takemori
2016-03-24 15:57 ` Michael Heerdegen
2016-03-24 16:39   ` Nicolas Petton
2016-03-24 18:04   ` Nicolas Petton
2016-03-24 18:26     ` Nicolas Petton
     [not found] ` <8760waoddm.fsf@petton.fr>
2016-03-25 15:00   ` Sho Takemori
2016-03-25 15:14     ` Nicolas Petton
2016-03-25 15:20       ` Sho Takemori [this message]
2016-03-25 17:32       ` Michael Heerdegen
2016-03-25 17:44         ` Michael Heerdegen
2016-03-25 18:45           ` Nicolas Petton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHbQ=cWFPzD3vpvaPKCQ5YMCBSHvW-aV2EaBGdmwWWfXmYbMoA@mail.gmail.com' \
    --to=stakemorii@gmail.com \
    --cc=23105@debbugs.gnu.org \
    --cc=nicolas@petton.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).