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: Codifying some aspects of Elisp code style and improving pretty printer Date: Fri, 01 Oct 2021 11:26:51 -0400 Message-ID: References: <87o88bntv8.fsf@gmail.com> <87wnmyy29v.fsf@gmail.com> <871r56nlhd.fsf@gmail.com> <87v92hw7gq.fsf@gnus.org> <87a6js253t.fsf@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="blaine.gmane.org:116.202.254.214"; logging-data="36153"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , Bozhidar Batsov , akater , Emacs Devel To: Robert Pluim Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 01 17:28:20 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 1mWKSR-00096v-Sc for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Oct 2021 17:28:20 +0200 Original-Received: from localhost ([::1]:56216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWKSQ-0001cn-Dz for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Oct 2021 11:28:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWKRA-0000XP-GQ for emacs-devel@gnu.org; Fri, 01 Oct 2021 11:27:00 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:44695) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWKR6-0001p4-PP for emacs-devel@gnu.org; Fri, 01 Oct 2021 11:26:59 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D3A254409F2; Fri, 1 Oct 2021 11:26:53 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 62424440A6F; Fri, 1 Oct 2021 11:26:52 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1633102012; bh=bccrMdasfH2iINnPEuS3Dj7qd7gRATXf9KwtieBzPrA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=hN/C9UmfWDvBTrSWvh0ry6MJzWrujg57kHxO+Sde01VcHP+vmW2u7i7we12l+hlJP XBnGL1tpt0b556ZUfxGzOWy4iE/2AGrUc25RI7cHdp3Dvh8RFJ2GVLE3YnHHk8tOBq kf8MWoKEoCEf++pDGFMlVLjzydHnDrPjvpWpAydDCsXnQUPCSTsnm+awVw2tEcvA0Y XCsBZErPvw4qXvbtY+UOQtxSbfxEnR4tUlCDvHif/VYD17pKrKb6/vUibDrhQEuySE GomGKMY17pPXV5UxxgMVP3W9ovmbn2lTJfhGzlidyhxoOcjbJN1hC3ZlEm4ojvOHBj DA839AjG17AQg== Original-Received: from pastel (unknown [45.72.241.23]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 242AB1201E6; Fri, 1 Oct 2021 11:26:52 -0400 (EDT) In-Reply-To: <87a6js253t.fsf@gmail.com> (Robert Pluim's message of "Fri, 01 Oct 2021 16:26:46 +0200") 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:275989 Archived-At: > Apropos, I believe the current recommendation is to do > (mapconcat #'identity seqs " ") > rather than > (mapconcat 'identity seqs " ") > ie function-quoting the argument to mapconcat, apply, mapc etc, but Indeed, the main benefit being that the byte-compiler can warn you if the function is not known to be defined (typically because of a typo or a missing `require`). A side benefit is that it "does the right thing" for `cl-flet` and friends. > 1. The elisp manual doesn=CA=BCt say that in (info "(elisp) Mapping Funct= ions") Not sure that'd be the best place, but we should probably adjust the manual to encourage the use of #' to quote function names, > 2. Emacs' code itself doesn=CA=BCt do that consistently The difference is sufficiently unimportant that I don't see a need to try and make it consistent in this respect. E.g. I do change 'foo to #'foo quite often, but only as part of other changes. > (and we have the odd #'(lambda ...) as well I don't see anything wrong with #'(lambda...) [ I personally prefer to skip the #' to make the code (marginally) shorter, but it's purely a matter of taste and I usually try and refrain from making this change in existing code unless it helps make the code fit into 80 columns. ] > 3. The byte compiler doesn=CA=BCt warn about it. Mine does ;-) But I wouldn't want to enable such a warning by default (or at least it should be mess a bit less eager than it is, because of the occasional false positives). > I believe it helps the byte-compiler generate better code, but don=CA=BCt > know what the actual effect is. It has no effect on the generated code. Stefan