From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Always-true predicate? Date: Sat, 20 Feb 2021 08:58:27 -0500 Message-ID: References: <875z2qoqc6.fsf@gnus.org> <87h7ma25so.fsf@tcd.ie> <8735xu33jy.fsf@gnus.org> <87lfbm1o5s.fsf@gnus.org> <874kiaxxbs.fsf@iki.fi> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12193"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: "Basil L. Contovounesios" , Lars Ingebrigtsen , emacs-devel@gnu.org To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Feb 20 14:59:23 2021 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 1lDSn5-00034A-Hj for ged-emacs-devel@m.gmane-mx.org; Sat, 20 Feb 2021 14:59:23 +0100 Original-Received: from localhost ([::1]:38662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lDSn4-0006CN-Ji for ged-emacs-devel@m.gmane-mx.org; Sat, 20 Feb 2021 08:59:22 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lDSmI-0005gV-Bk for emacs-devel@gnu.org; Sat, 20 Feb 2021 08:58:34 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:32759) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lDSmF-00065V-W6 for emacs-devel@gnu.org; Sat, 20 Feb 2021 08:58:33 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 7D8A044030A; Sat, 20 Feb 2021 08:58:30 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 1633A440165; Sat, 20 Feb 2021 08:58:29 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1613829509; bh=UZusJGfCbvUON+JRgF/2gynlVafxX5MvZpPJQSdkD0Y=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=MHoJhKL5jpIPnk4ckn+TnWIDe9pB78nEjTNhhUyahLWNYhi2PICelc1FgY+aMNhZI fazz73aDu7fMP5m2qRAXMBAeRovxhf1hr2ZgIqLXSr4Y00DUa1smVo7HgpcPjhiyIo V1FevclFYXjggWzVB7HLBZwV+nJF+ZTz4OeSh7xn6ZuWgUhjXkZ7Rxhl7J2HeBy3Gc NcAL5lqq6y4RVjJhMhkQQymyj4TgZ2eNLnAXZkSGjFAvjqt9NB6qHaQ1f4mM9MB5JT 3slx76s4GX3mjOf1zhKj7O20jIaPSikkkGPs2qV8PJlOCTRxFEwgbiNonG3g6MkXMP sY4LqWTqvZs4A== Original-Received: from alfajor (unknown [216.154.41.47]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2A43E1203B6; Sat, 20 Feb 2021 08:58:29 -0500 (EST) In-Reply-To: (Pip Cet's message of "Sat, 20 Feb 2021 09:40:38 +0000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:265308 Archived-At: >> Also, I'm not completely sure in which sense it "miscompiles" it, >> since it can't be compiled correctly, AFAIK. ] > > ??? > > It's perfectly valid ELisp. It should throw. It doesn't. You're right, technically. But most of the time that code like that shows up, it's just a bug and the intended semantics is different. IOW I'd be surprised if there is a piece of code out there that wants this to signal an error ;-) [ But, just to clarify: I'm not trying to defend this as "not a bug". It *is* a bug in the optimizer, no more, no less. ] > So to avoid having to cons up a new list you have to know about the > callee to know it doesn't do that, which apply prevents you from > doing. I don't see what you mean by "apply prevents you from doing". But in any case, I'd happy to change my stance to say that the guilt is shared between `apply` and `&rest`. And yet another way to look at it is that the real culprit is the fact that `cons` cells are mutable ;-) > Looking forward to your patch removing all argument names from defuns > everywhere ;-) It's almost ready. > It seems obvious to me that if f and g are "the same", Function equality and "obvious" just don't belong in the same sentence, IMO. > BTW, I made a mistake in my previous email: > > (f a &rest b c) should be equivalent to (apply #'f a (append b (list > c))). No zips, and no spreadification of the last argument. That reminds me of the macro `gnus--,@` I introduced recently (it's not the same, since ,@ would splice at macro-expansion time, whereas your &rest here wants to splice at run time). Stefan