From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Improving aesthetics & readability of backquote Date: Mon, 20 May 2019 08:52:41 +0000 Message-ID: <20190520085241.GA5136@ACM> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="120235"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: emacs-devel@gnu.org To: "Paul W. Rankin" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 20 10:53:00 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSe2V-000V8E-NO for ged-emacs-devel@m.gmane.org; Mon, 20 May 2019 10:52:59 +0200 Original-Received: from localhost ([127.0.0.1]:60200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSe2U-0006n4-NA for ged-emacs-devel@m.gmane.org; Mon, 20 May 2019 04:52:58 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:50106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSe2M-0006mu-C4 for emacs-devel@gnu.org; Mon, 20 May 2019 04:52:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSe2L-0006uX-48 for emacs-devel@gnu.org; Mon, 20 May 2019 04:52:50 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:51127 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1hSe2K-0006tX-Lc for emacs-devel@gnu.org; Mon, 20 May 2019 04:52:48 -0400 Original-Received: (qmail 90343 invoked by uid 3782); 20 May 2019 08:52:42 -0000 Original-Received: from acm.muc.de (p4FE15E7C.dip0.t-ipconnect.de [79.225.94.124]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 20 May 2019 10:52:41 +0200 Original-Received: (qmail 5198 invoked by uid 1000); 20 May 2019 08:52:41 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:236780 Archived-At: Hello, Paul. On Mon, May 20, 2019 at 13:03:21 +1000, Paul W. Rankin wrote: > wrt. > http://lists.gnu.org/archive/html/help-gnu-emacs/2019-05/msg00022.html > I understand that aesthetics and readability are not going to be a > concern for many, but I'd like to put forth this suggestion > anyway. > For as long as I've used Emacs Lisp, I've found the backquote[1] > to be ugly and unreadable, to the extent that I've gone to lengths > to avoid using it. It looks like a mistaken quote added by someone > using an unfamiliar keyboard. Then when you add the splice... > ugh.. > (setq a '(3 4)) > (setq b '(6 7)) > `(1 2 ,a 5 ,@b 8) > -> (1 2 (3 4) 5 6 7 8) > I know people make fun of Perl for being "line noise"[2] and IMO > the backquote approaches that. I personally have no such problems with backquote. If anything, the comma operator appearing _before_ something rather than after it jars a little. But only a little. > Add to this the \` is just an alias for backquote, which doesn't > imply any meaning except as relation to itself. Its meaning cannot > be inferred through the code alone. Sorry, I can't make anything out of that paragraph. What meaning? What relation to what? Which code alone? > I suggest that we could introduce some aliases and augment the > reader constucts a little to make them more aesthetically pleasing > and more readable. I don't agree with you that (quote foo) is more readable than 'foo. I would find (quote foo) tiring to write, and (more importantly) tiring to read. I believe very early lisps were lacking the ' operator. (quoteval foo) would be even worse for me. > The easy first step would be chosing a nice and meaningful alias > for backquote. Considering the semantic role of backquote seems to > be both to "quote" and selectively "eval" its body form, and > together with the tradition of Emacs Lisp making contractions from > e.g. "define" + "function" -> "defun", then I suggest: > (quoteval ...) > Which sits similarly to: > (quote ...) > (eval ...) > Then it would be a case of augmenting the "unquote" ,VAR and > "splice" ,@VAR reader constructs: > (quoteval (1 2 (unquote a) 5 (splice b) 8 )) > -> (1 2 (3 4) 5 6 7 8) > (Both "insert" and "unquote" are used in backquote.el; I lean > towards "unquote" because there is already the function "insert".) > Although the above is more verbose, to me this is immediately > clear what's happening in the code, and is much more aesthetically > pleasing. To me, it would be the opposite. It would be less aesthetically pleasing. And tiring to read. > If it remains unclear, my suggestion is not to supplant the > original syntax; I position this suggestion in a similar vein as > the rx library. But code has to be maintained, and everybody would have to know the meaning of these new aliases, and be practiced with them, to be able to maintain code using them. > Thoughts? I'm afraid I'm against such changes. > [1]: (info "(elisp) Backquote") > [2]: https://famicol.in/sigbovik/ > -- > https://www.paulwrankin.com -- Alan Mackenzie (Nuremberg, Germany).