From: okamsn--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 70524@debbugs.gnu.org
Subject: bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces
Date: Mon, 29 Apr 2024 01:08:42 +0000 [thread overview]
Message-ID: <e6e8a5d7-b6c8-4d07-8356-5c1e41da0a9c@protonmail.com> (raw)
In-Reply-To: <878r10xqnd.fsf@web.de>
Michael Heerdegen wrote:
> okamsn@protonmail.com writes:
>
>> My purpose with this patch and for bug#68863 regarding `seq-subseq`
>> (which does not currently support `setf`, and I think should allow
>> subplaces like `substring` claims to)
>
> The `substring' gv-setter doesn't need a loop however, it creates a new
> string using `concat'. Your patch would probably "work" ok in this
> case, but I'm not convinced that this would be an improvement, still for
> the same reasons.
>
>> was for destructuring as `setf`-able places, like in cl-loop's `for
>> VAR in-ref LIST`. I have implemented that for my Emacs Lisp package
>> (https://github.com/okamsn/loopy), but not all of the `setf`-able
>> destructuring constructs support sub-places in the expected way, due
>> to how some of the GV expansions are defined.
>
> But if loopy would base on an inefficient implementations this would not
> be useful.
>
> Are there examples where your patch is really a clear improvement?
Hello,
I have found cases in Loopy where I am using `(setf (map-elt (map-elt
...))` and similar. From what you and others have said, it sounds like
this luckily happened to work but should not have been relied upon. I
have now seen the thread bug#62068 about `map-nested-elt` mentioned by
Augusto Stoffel, and I agree with the thoughts there that an improvement
can be made for that use case. That could be having `map-elt` support
sub-places in general, or it could be having `map-nested-elt` be a
generalized variable to support the one case.
On efficiency and maybe outside of the sub-place question, I used
`seq-map` because I thought that it would be a good way to make sure
that the generic sequence was only moved through once. For a
hypothetical `seq-replace`, do you think it would be better to use a
combination `seq-concat`, `seq-take`, and `seq-subseq` and to assume
that they are efficient implementations for the generic version? Do you
think that it would be better if there were different implementations
for each combination of the built-in sequence types, like the checks
`cl-replace` has for lists and arrays?
Thank you.
>
> Michael.
next prev parent reply other threads:[~2024-04-29 1:08 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 [this message]
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
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
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=e6e8a5d7-b6c8-4d07-8356-5c1e41da0a9c@protonmail.com \
--to=bug-gnu-emacs@gnu.org \
--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 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).