From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#40570: [PATCH] Alias cl-subseq to seq-subseq, define gv-setter in the latter Date: Sun, 12 Apr 2020 12:18:15 -0400 Message-ID: References: <20200412094627.2494060-1-stepnem@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="86961"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 40570@debbugs.gnu.org To: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 12 18:19:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNfKA-000MVP-SW for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Apr 2020 18:19:11 +0200 Original-Received: from localhost ([::1]:34974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNfK9-0008FS-Ld for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Apr 2020 12:19:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43501) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNfK2-0008FL-To for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 12:19:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jNfK1-0006tN-Um for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 12:19:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47159) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jNfK1-0006tB-PV for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 12:19:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jNfK1-0004bA-LS for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 12:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Apr 2020 16:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40570 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 40570-submit@debbugs.gnu.org id=B40570.158670831117643 (code B ref 40570); Sun, 12 Apr 2020 16:19:01 +0000 Original-Received: (at 40570) by debbugs.gnu.org; 12 Apr 2020 16:18:31 +0000 Original-Received: from localhost ([127.0.0.1]:58705 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jNfJX-0004aV-FX for submit@debbugs.gnu.org; Sun, 12 Apr 2020 12:18:31 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:17710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jNfJW-0004aJ-A4 for 40570@debbugs.gnu.org; Sun, 12 Apr 2020 12:18:30 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id AE81010033A; Sun, 12 Apr 2020 12:18:24 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 06953100311; Sun, 12 Apr 2020 12:18:23 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1586708303; bh=VpztlQ3v8hHaUPsBcLcBhvKVjwLfB1bCygKmlxfx2MM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=aSd3mYlyTz2wMYy+8VB0k0amSmQ1Dh6IasDWMAvKENAHHU3v7Z7P44To8UnFWZxjE kVva6qB6so2/pBv+JuvC56EipY9QGL8NpLOl3BXR1/+VwgaiTQYLoZBwbcwtL+1L86 QH1RVniejNTCNZQnKslECFEnugA4zClq4EkCNLV+3JAMNLgGSNC0m6SYW/2rrjvaJo ew6ft2KsfAR6GOF7SRZgALLxJQQWwn343+PnG4Lt4q67Ak5RxqEtU9HcthwS6O1fIq seqUoGzn9u8iuc+FPtzFGvc96WIIysT4ImfyiMb3PtzIJyIzzTmlWv0c1iKnrWWLD6 rK+9J7hyArQaA== Original-Received: from alfajor (unknown [104.247.241.114]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C64D412027A; Sun, 12 Apr 2020 12:18:22 -0400 (EDT) In-Reply-To: <20200412094627.2494060-1-stepnem@gmail.com> ("=?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?="'s message of "Sun, 12 Apr 2020 11:46:27 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:178256 Archived-At: > The definition was moved in > > 2019-10-27T13:25:00-04:00!monnier@iro.umontreal.ca > 0e4dd67aae (* lisp/emacs-lisp/seq.el: Don't require cl-lib.) > > already, but not the gv-setter declaration, so 'setf' worked with > 'cl-subseq', but not with 'seq-subseq'. Indeed, when I made the move I just wanted to change the implementation but not the featureset (AFAIK seq-subseq never supported `setf`). So this bug report is fundamentally a feature request: make `seq-subseq` into a (gv) generalized variable. > --- a/lisp/emacs-lisp/seq.el > +++ b/lisp/emacs-lisp/seq.el > @@ -154,6 +154,11 @@ seq-subseq > START or END is negative, it counts from the end. Signal an > error if START or END are outside of the sequence (i.e too large > if positive or too small if negative)." > + (declare (gv-setter > + (lambda (new) > + (macroexp-let2 nil new new > + `(progn (cl-replace ,sequence ,new :start1 ,start :end1 ,end) > + ,new))))) The main purpose of the move was to reverse the order of dependency so that `cl-lib` would depend on `seq` rather than the reverse. This implies that `seq` shouldn't use `cl-lib`. The above `cl-replace` is hence problematic. Another issue is that `seq-subseq` is a generic function, so its gv-setter should also use generic functions so that it can also be made to work on other sequence types than the predefined ones. IOW we should probably introduce a new `seq` generic function which does something similar to `cl-replace`, then make `seq-subseq` use it in its gv-setter, and ideally also make `cl-replace` use it ;-) Stefan