From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: akater Newsgroups: gmane.emacs.devel Subject: Re: defmacro with built-in gensym declaration and initialization Date: Thu, 21 Jan 2021 19:34:02 +0000 Message-ID: <875z3q6q51.fsf@gmail.com> References: <87bldk6n2l.fsf@gmail.com> <87turbiuvr.fsf@tcd.ie> <878s8n76ih.fsf@gmail.com> <87o8hj9vl9.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20893"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: "Basil L. Contovounesios" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jan 21 20:48:27 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 1l2fwR-0005L0-PR for ged-emacs-devel@m.gmane-mx.org; Thu, 21 Jan 2021 20:48:27 +0100 Original-Received: from localhost ([::1]:43016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2fwQ-0003Q8-QB for ged-emacs-devel@m.gmane-mx.org; Thu, 21 Jan 2021 14:48:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2fsr-0000Uh-9n for emacs-devel@gnu.org; Thu, 21 Jan 2021 14:44:45 -0500 Original-Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:39589) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l2fsp-0004vz-Iq for emacs-devel@gnu.org; Thu, 21 Jan 2021 14:44:44 -0500 Original-Received: by mail-ed1-x535.google.com with SMTP id b21so3906811edy.6 for ; Thu, 21 Jan 2021 11:44:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=Jpoc7Eeu59Zpl0cpylbVq8crF3Icn35J166Ge2sKSQY=; b=FIlQDfxBhTVtEPBdJ2bcH3kjVaTpKUDq07YCNU406vV5H2AVkCAPOeSkmbYtE66Zot CIGZPnGGzuNw6qJtkSaQv0rPswFib42R4jejKd7inyZKXLtUeo8Cg4adoANBxaS5POJU DYFUSBofg7najy0dM1CbraNkgnB2FPaRLDexR6ULL5O8tHxrpf9i2KjzQ0FvsppTT203 vEKAqDMDuMBZ5s9Pwj379+Khyxhrmtl+Hjzp8tAwKe5xSZDDRJXsP2Qg71Sx8b6f5kkv sk57u6ZHfWlqvXoT9GwK/Nt+JMjnqR8aCQx33RKdP3dDwGx0xFuj8qCk+v0nWrRzfI3t e+KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=Jpoc7Eeu59Zpl0cpylbVq8crF3Icn35J166Ge2sKSQY=; b=Clc9HtFgM1eEPu8QO3st94RhFzOi8TeaNomzKHNGR1+ijpmUea10uB1qsy0iRDbe3D VEG2AVmusHjsXsROJH7y90UiITaA0pZlnKaNMKjQidELKzte9GEApqEGpHaxgfpWjILO w5OmooUACHxc4WQhfKdSpXklgZi0WeHQ6IvI0i5Vc7v0eJxR6lkBnNn+OE2+VeCQvZdh 8C4JYsHB0K5eU9uTTNlfAgUS2tTnAoIWOEG9zgMs4/LwSLkENDTQ5dWQQ9aj0rpAqzF+ N84A3qcPmcIDYBrCFiWLkZq2j+o9Ax4d3L7MK1ICP6x+S3XvzoHSAT/cdfDfWp5tRDOr wwPw== X-Gm-Message-State: AOAM533LO6cFXTJSyzJHI3pnlAJYbjpnrqDuZqrAApMJrEE7E0c7pHVL f3LG1E58iPF7QKs2NEXk+0s= X-Google-Smtp-Source: ABdhPJwUw4oMyAjWxy1YIs163FA7NAUMYwc/evBKOw/AFzHD8XUSaVK4hhWzvm6DtXZAV490geoIKQ== X-Received: by 2002:a50:852a:: with SMTP id 39mr611860edr.114.1611258281628; Thu, 21 Jan 2021 11:44:41 -0800 (PST) Original-Received: from localhost ([185.220.101.205]) by smtp.googlemail.com with ESMTPSA id k2sm2671391ejp.6.2021.01.21.11.44.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jan 2021 11:44:40 -0800 (PST) In-Reply-To: <87o8hj9vl9.fsf@tcd.ie> Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=nuclearspace@gmail.com; helo=mail-ed1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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:263250 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable "Basil L. Contovounesios" writes: > Let's just say I would sooner see native arglists gain support for > keyword arguments ;). > > For non-native arglists, we could always extend cl-defmacro or some > other definition definer. Sorry, I suspect I misunderstood. What's a native arglist? Doesn't defmacro already have native support for &optional and &rest keywords? > I was referring to the arity of the macro being defined, not that of > defmacro. I guess I'm confused, again. The arity of macro being defined remains exactly the same. See the --partition-by example in the original message. defmacro/&gensym is a drop-in replacement; it doesn't change any arities. > It and its variant macroexp-let2* are relevant wherever the macro author > wants to avoid evaluating an argument more than once, but improvements > are always welcome. That's usually called =E2=80=9Conce-only=E2=80=9D but unlike once-only, mac= roexp-let2 also requires a test function which is exactly why I called it =E2=80=9Can overcomplicated once-only=E2=80=9D. &gensym is also relevant wherever the = macro author wants to avoid evaluating an argument more than once, and where the argument needs to be evaluated unconditionally, but it's more concise, both in terms of token count and nesting depth. One variation of defmacro/&gensym accessible in the linked repository does perform the same elimination of bindings as macroexp-let2, only it uses a hardcoded test function, namely macroexp-const-p. >> Since we're moving to >> natively compiled Elisp, I was thinking it's going to become less >> relevant in near future, and &gensym covers most use cases of once-only. > > I don't see how native compilation changes how existing and new Elisp > macros ought to be written. What's the purpose of TEST in macroexp-let2, then, other than to minimise bindings in the expansion? (Which I presume is only relevant when Elisp's byte compiler is used to compile the expanded form.) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJLBAEBCgA1FiEEgu5SJRdnQOF34djNsr6xYbHsf0QFAmAJ1yoXHG51Y2xlYXJz cGFjZUBnbWFpbC5jb20ACgkQsr6xYbHsf0RZPA/6AkH7DaIL3yEdj5yJFZbso2Zx AuMJIvDRT7ia4T28b84uH4rn6oV7YPrk2KwSaW2n1Xtjm7su/ljmerhRB2xw7Uye 4gQCXnyQAodC6In0EFyOS3HETt0TJgqh6/QtrK65JwcwpqU2K3pAowPREr7fcr37 ccqlVXbYdJJUB5OT7AfRRsR8HEBZTGUl/HdxlWRBe58/5thMVDxL2AdPlQclPYFt wCk4lLhtNw7u8EG6T1oK77OX/1zTdwNel+ZJdjsWLpTSrASTWaYb/GKWmkDlwdgu 3qE2pHXLAXvzx9UbuVpUmE/qOFW5jTL+RMB+IqEKecSR+Viup1ZoZEWgNcQRBBjf 2lLrWJqHSt4jSrKlcByihjGl5QyKQfkI6uM/QBcWng+xH1JMV3n5yX4TbJucX/jk xWPIWabY5+EwFUh03OCEsRftfk0KgSQxDc44VQ/8g1GzMI86E/RrTyDuaIDC5WBi BnAj22uMRQweUdVmTVeenTGrZhisYmfjWGI26wRsDRhIECmHQYpHHt73GObEXh1r sxyR42VA6176dqlfA4cKb8WHjDg9UFTjVGH41iOXHcEMV9vTw4lOSTzpGsGEioY+ sOCKlirXSDqqO10LE0auKH3fY8R8N4igCOIg86bPxhEsCGEUcZCxaxOCpLvHrXRg uX+m+B/7oQiXScjBV+g= =mWko -----END PGP SIGNATURE----- --=-=-=--