From: Augusto Stoffel <arstoffel@gmail.com>
To: 70524@debbugs.gnu.org
Cc: michael_heerdegen@web.de, okamsn@protonmail.com,
monnier@iro.umontreal.ca
Subject: bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces
Date: Thu, 25 Apr 2024 14:42:19 +0200 [thread overview]
Message-ID: <878r11obpw.fsf@gmail.com> (raw)
In-Reply-To: <87frv9odi4.fsf@gmail.com> (Augusto Stoffel's message of "Thu, 25 Apr 2024 14:03:47 +0200")
On Thu, 25 Apr 2024 at 14:03, Augusto Stoffel wrote:
> On Tue, 23 Apr 2024 at 02:10, Okamsn via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:
>
>> Hello,
>>
>> Currently, the use
>>
>> (let ((arr (vector 0 1 2 3 4 5 6)))
>> (setf (map-elt (cl-subseq arr 3) 0)
>> 27)
>> arr)
>>
>> expands to
>>
>> (let ((arr (vector 0 1 2 3 4 5 6)))
>> (let* ((v arr))
>> (condition-case nil
>> (with-no-warnings
>> (map-put! (cl-subseq v 3) 0 27 nil))
>> (map-not-inplace
>> (let* ((new (map-insert (cl-subseq v 3) 0 27)))
>> (progn
>> (cl-replace v new :start1 3 :end1 nil)
>> new))
>> 27)))
>> arr)
>
> Since map-put! may raise a not-in-place signal, and I doubt the macro
> expansion checks for whatever condition it is that leads to that, I
> would say this use-case is essentially broken.
Sorry, just ignore that :-).
What I actually wanted to say is that IMO there's a general conceptual
problem to consider map-like values as places. There's no reasonable
way (cl-subseq arr 3) can be seen as a place AFAICT.
But even in a language like Python (where map-like things can be seen as
places, since there are no liked lists to ruin the party), I don't
understand what the above code is supposed to do. This code
arr = [0, 1, 2, 3, 4, 5, 6]
arr[3:][0] = 27
arr
will just copy a portion of arr as new list, mutate its first element,
then throw array that copy.
next prev parent reply other threads:[~2024-04-25 12:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 2:10 bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces Okamsn via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-24 6:06 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-24 20:14 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-25 1:59 ` okamsn--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-25 12:49 ` Augusto Stoffel
2024-04-26 12:19 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-29 1:08 ` okamsn--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-29 1:54 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-30 16:17 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-25 12:03 ` Augusto Stoffel
2024-04-25 12:42 ` Augusto Stoffel [this message]
2024-05-06 14:02 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878r11obpw.fsf@gmail.com \
--to=arstoffel@gmail.com \
--cc=70524@debbugs.gnu.org \
--cc=michael_heerdegen@web.de \
--cc=monnier@iro.umontreal.ca \
--cc=okamsn@protonmail.com \
/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 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.