From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler Newsgroups: gmane.emacs.bugs Subject: bug#63103: 30.0.50; nconc compiler optimization breaks user packages Date: Thu, 27 Apr 2023 08:37:36 +0200 Message-ID: References: <877cty45rx.fsf@gmail.com> <871qk5516v.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4208"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mattiase@acm.org, Stefan Monnier , 63103@debbugs.gnu.org To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 27 08:38:15 2023 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 1prvGh-0000s2-N8 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 Apr 2023 08:38:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prvGZ-0003o9-7f; Thu, 27 Apr 2023 02:38:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prvGU-0003nb-B6 for bug-gnu-emacs@gnu.org; Thu, 27 Apr 2023 02:38:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prvGU-00085k-2E for bug-gnu-emacs@gnu.org; Thu, 27 Apr 2023 02:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1prvGT-0003Ab-Tn for bug-gnu-emacs@gnu.org; Thu, 27 Apr 2023 02:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Apr 2023 06:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63103 X-GNU-PR-Package: emacs Original-Received: via spool by 63103-submit@debbugs.gnu.org id=B63103.168257746812162 (code B ref 63103); Thu, 27 Apr 2023 06:38:01 +0000 Original-Received: (at 63103) by debbugs.gnu.org; 27 Apr 2023 06:37:48 +0000 Original-Received: from localhost ([127.0.0.1]:57454 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1prvGG-0003A6-GI for submit@debbugs.gnu.org; Thu, 27 Apr 2023 02:37:48 -0400 Original-Received: from server.qxqx.de ([178.63.65.180]:57529 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1prvGD-00039o-DH for 63103@debbugs.gnu.org; Thu, 27 Apr 2023 02:37:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de; s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=49K4bxdEGkJSkFQnlZS8Xj+HtP8sTi4QFzEF20qv6Ys=; b=Uctp8gOfdvhppDHw3uYGxi3BG6 XbSRepWulkZcNn2Pu4DI7ePIFdAvmXiODX1qMozvTdkJ4bGQZEyDvWj26yyiqi3euIlFn1N3aRO35 1DBdlYr2r4ME7a1rsdN8v2vVxAdkb05ksUi8mS1+wpFfNi+GI69SvE282HtQHKCeuhK8=; Content-Language: en-US In-Reply-To: <871qk5516v.fsf@posteo.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:260705 Archived-At: On 4/27/23 07:44, Philip Kaludercic wrote: >> The problem is that `(nconc list nil)` is optimized to `list`. However >> improper lists like `(a b c . 0)` should be turned into `(a b c)`. > > Where is this behaviour documented? This behavior is not documented explicitly. However the docstring states that "Only the last argument is not altered, and need not be a list". Due to symmetry reasons it is not far-fetched to assume that when `nconc' can be used to turn a proper list into an improper list, that the inverse works too. Most of the docstrings do not specify functions on such a detailed and formal level. Maybe Stefan can give a bit more background regarding the support of improper list for Elisp functions. The main use case I've observed is for `completion-all-completions' which uses the last cdr to return the base position of the completion. Iirc `cl-loop' also handles improper lists. Generally I'd be wary about changing the semantics of functions since this leads to bugs which are hard to debug. One could decide to restrict `nconc' to proper lists only, not only via the bytecompiler optimization but also by erroring out if improper lists are passed as argument. Probably it is easier to explicitly allow the last nil argument in the bytecode optimizer specially to retain the existing behavior for improper lists. Daniel