From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.devel Subject: Re: (byte-compile '(append '(1 2) '(3 4))) Date: Sat, 16 Mar 2024 14:23:08 +0100 Message-ID: <87wmq2nweb.fsf@epfl.ch> References: <87v8j28c2x.fsf@betli.tmit.bme.hu> <874jdipfp5.fsf@posteo.net> <87cys6t734.fsf@betli.tmit.bme.hu> <87r0gmnjq4.fsf@posteo.net> <87o7bprr04.fsf@betli.tmit.bme.hu> <87bk7p57yz.fsf@posteo.net> <87r0gatlqz.fsf_-_@betli.tmit.bme.hu> <87cyrubazs.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7680"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Felician Nemeth , emacs-devel@gnu.org To: Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 16 14:24:05 2024 Return-path: Envelope-to: ged-emacs-devel@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 1rlU17-0001rv-JS for ged-emacs-devel@m.gmane-mx.org; Sat, 16 Mar 2024 14:24:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rlU0I-000259-K3; Sat, 16 Mar 2024 09:23:14 -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 1rlU0H-00024v-66 for emacs-devel@gnu.org; Sat, 16 Mar 2024 09:23:13 -0400 Original-Received: from mail-ej1-f51.google.com ([209.85.218.51]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rlU0F-0007qc-JS for emacs-devel@gnu.org; Sat, 16 Mar 2024 09:23:12 -0400 Original-Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a467bd57898so62666166b.1 for ; Sat, 16 Mar 2024 06:23:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710595390; x=1711200190; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TYgM2hD8WIfA18bGAfmbI8ci5DK/ZQmZrydcaKrOmN0=; b=lzIEwUoag+8nJ8tKc7LUZzp2E3lK7cYF9k50iggAT73N+tMAz2h8p5gVUvqE9S8HTJ 4oG+yYqgHod0D2tynmjSxGQeWbk/2AY44MgihcMWWeWhfXU3OBvfjRHpPBkGILoqQjBO EYEZJocjL0n56we6cuXOzfY7jdDKFTUQr07Q/4BFoqRCirPD9wvN8CrKUjvb9TLYXlgb u0sk2k7adZrW9rcTA0HAyYoBoZ4rqSUXipLILvhEp0tvEca+XUd64CvWZ3dCUN+YgbUQ fLh3FHdMtGX/JcO9ZLaUZ4R+1iV3lbRsgjTDjk401K5ry1PQ2CpIciw/+lONiBC4R14o /1vA== X-Forwarded-Encrypted: i=1; AJvYcCX/ur+oXHbP/xDt+ht5INpIg7YTwuvL8vwwppg+Kedq50hk9Gg5bjmWEDQKeJZvLt8N4fjPCoMnspKBEX7Jb6V4QYDH X-Gm-Message-State: AOJu0YzH28xv8wpDb7Ow73XlxJ5vWr2AgUQAl3EWZ+zNBCW7b0SPx1tI 1ovcwuxSAg5NmKUsvX6+EtFOTbO4zCaLGzPStl9R7dtO2FbU12zv X-Google-Smtp-Source: AGHT+IGG+xjY1XBQfjIdlGQbVkh7Bm4qTFGxg6rqtjcnHPGaSjbWVP3zEUwi6l9L3bT00jT8pCgMrQ== X-Received: by 2002:a17:906:34d6:b0:a45:ced8:e138 with SMTP id h22-20020a17090634d600b00a45ced8e138mr3554061ejb.1.1710595389667; Sat, 16 Mar 2024 06:23:09 -0700 (PDT) Original-Received: from localhost ([2a02:aa12:b101:f580:7e85:981f:c305:2cf1]) by smtp.gmail.com with ESMTPSA id ef3-20020a17090697c300b00a468c3295d5sm1480033ejb.25.2024.03.16.06.23.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Mar 2024 06:23:09 -0700 (PDT) In-Reply-To: <87cyrubazs.fsf@posteo.net> (Philip Kaludercic's message of "Sat, 16 Mar 2024 12:46:15 +0000") Received-SPF: pass client-ip=209.85.218.51; envelope-from=basil.conto@gmail.com; helo=mail-ej1-f51.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:317110 Archived-At: Philip Kaludercic [2024-03-16 12:46 +0000] wrote: > I am not sure what the danger is in the case of constant, quoted lists, > but I am not familiar with the byte compiler either. It seems like this > > diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el > index f75be3f71ad..e6f18590705 100644 > --- a/lisp/emacs-lisp/byte-opt.el > +++ b/lisp/emacs-lisp/byte-opt.el > @@ -1599,6 +1599,12 @@ byte-optimize-append > (cdr args)) > (cdr newargs))) > > + ;; (append '(C1...) ... '(C2...)) -> (append C1... ... C2...) > + ((cl-loop for arg in args > + always (and (eq (car arg) 'quote) > + (proper-list-p (cdr arg)))) > + `',(mapcan #'cadr args)) > + > ;; non-terminal arg > ((cdr args) > (cond > > > would do the trick, and the byte-code is even better: > > byte code: > args: nil > 0 constant (1 2 3 4) > 1 return Is this correct? According to its docstring, append's last argument must be eq to the tail of its return value. -- Basil