From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= 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 19:16:08 +0200 Message-ID: <87lfn0bp5z.fsf@gmail.com> References: <20200412094627.2494060-1-stepnem@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="58711"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 40570-done@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 12 19:16:28 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 1jNgDc-000F9P-Fi for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Apr 2020 19:16:28 +0200 Original-Received: from localhost ([::1]:35384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNgDb-0006CU-8b for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Apr 2020 13:16:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48224) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNgDG-0006Bi-Lf for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 13:16:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jNgDC-0002AG-Ki for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 13:16:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47235) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jNgDC-0002A5-HS for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 13:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jNgDC-00064b-Ea for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 13:16:02 -0400 Resent-From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Apr 2020 17:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 40570 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 40570@debbugs.gnu.org, stepnem@gmail.com, stepnem@gmail.com Original-Received: via spool by 40570-done@debbugs.gnu.org id=D40570.158671174523306 (code D ref 40570); Sun, 12 Apr 2020 17:16:02 +0000 Original-Received: (at 40570-done) by debbugs.gnu.org; 12 Apr 2020 17:15:45 +0000 Original-Received: from localhost ([127.0.0.1]:58778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jNgCu-00063q-V5 for submit@debbugs.gnu.org; Sun, 12 Apr 2020 13:15:45 -0400 Original-Received: from mail-lj1-f196.google.com ([209.85.208.196]:38551) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jNgCq-00063V-28 for 40570-done@debbugs.gnu.org; Sun, 12 Apr 2020 13:15:43 -0400 Original-Received: by mail-lj1-f196.google.com with SMTP id v16so6661269ljg.5 for <40570-done@debbugs.gnu.org>; Sun, 12 Apr 2020 10:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-transfer-encoding; bh=TpP/rWwpNU1lNBQByICXDKs/LN51lAHBXA6N5iwLgLk=; b=hEn62XiGDZGHu0H9eQG7wGfj45EY2re8giQ1nPHH5omLG7jtlHgpzhvkWigvX0SJoM sQfnMNkdZe/upc2ggLu6cwZOJdU+fcS5pvQRyhRf8y3/ZzsGobRyHXsmfwsyCL9szE2Z 9Fj/6RXDGKvxPKt5Zld3rXJogSPrstP37xqaIvS+bJZFKLJAmjZEWR18QLzoRRPgZoiA HVU4WyecU+GxDLMS7eA7WO8qKMlp+D4YHaf9qo3dmXGX8gVgPINCQiiMeSi7SlekOTtD o5yeT1+9yFdtF/JHnfFpwpzfSO9skYLSq1a39ZV7EG4KNPsjwlevLkeQGPiGMZCWKlS9 Bt7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-transfer-encoding; bh=TpP/rWwpNU1lNBQByICXDKs/LN51lAHBXA6N5iwLgLk=; b=jCD1ddJIjNd6XUkfgxN/Nii46uk5BZK89jlxGFNMBsaOHba2vSqX+T2rmgrRh8NoTM /PySJLeW52nDyZWIb2iexEov98txgWEh1o9IOMKIdykKsdSKW+nlcPBIhW3r6S7uqSuK P0rCMrtDAHTJ//7ci4PuFLI3OBK4a5S4v95ssMuF/r9xOQw+Kf5JY9qi2c0W1bW+7Qm/ VaEXs4QiQqpnNHly8xKNreH2nchhLFsANkMikQcFav0lIDFYGczM2XnO7x8TUugJLpmu CMBCG0KAidLT4M9I+nV7G00WBFO3zW1XMQdtGTSM7RFTmFi8yNuJVxq4v8qplB5bJkEm DPtw== X-Gm-Message-State: AGi0PuaV6ZuQNYNsxrdkShw73VNq7aqgi3ckIt6AjiupqMvHRd+1qS3Y FK+bC+3eQp09os5U09QtYqU7O6kkJFI= X-Google-Smtp-Source: APiQypJLAJ+Pkx8qn5GZi/eN6r+t/Yh4LWrrunsdCaqqCkjalf8pqcj+8QAnuKmKq4CrhRGpUjNUOw== X-Received: by 2002:a2e:3603:: with SMTP id d3mr8559946lja.82.1586711734090; Sun, 12 Apr 2020 10:15:34 -0700 (PDT) Original-Received: from localhost ([185.112.167.47]) by smtp.gmail.com with ESMTPSA id j8sm6300923lfk.88.2020.04.12.10.15.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Apr 2020 10:15:33 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sun, 12 Apr 2020 12:18:15 -0400") 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:178266 Archived-At: On Sun, 12 Apr 2020 12:18:15 -0400 Stefan Monnier wrote: >> 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. Oh, right... sorry. > 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 ;-) Indeed. The definition of `cl-replace' looks like not for the faint of heart, also a lot of that impression comes from all the cl- prefixed args and variables. Is that just an artifact of some automatic replacement process, or is there a reason those have to have the cl- prefix? Or a conspiracy to make cl-*.el even more impenetrable? --=20 =C5=A0t=C4=9Bp=C3=A1n