GNU bug report logs -
#70524
[PATCH] Fix `map-elt` with `setf` for subplaces
Previous Next
Reported by: Okamsn <okamsn <at> protonmail.com>
Date: Tue, 23 Apr 2024 02:12:03 UTC
Severity: normal
Tags: patch
Done: Michael Heerdegen <michael_heerdegen <at> web.de>
Bug is archived. No further changes may be made.
Full log
Message #35 received at 70524 <at> debbugs.gnu.org (full text, mbox):
Michael Heerdegen wrote:
> okamsn <at> 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.
This bug report was last modified 1 year and 17 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.