From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: syntax question for defun Date: Thu, 29 Aug 2024 06:57:48 +0200 Message-ID: References: <6a7b894c-8c00-482e-b75c-ce87c0eb2b9c@greatalpha.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PsG+k05JywZ5+Z+K" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18269"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: David Elson Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 29 06:58:14 2024 Return-path: Envelope-to: geh-help-gnu-emacs@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 1sjXEb-0004Yc-Sl for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 29 Aug 2024 06:58:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjXEJ-0003Q6-Vz; Thu, 29 Aug 2024 00:57:56 -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 1sjXEH-0003PR-Ku for help-gnu-emacs@gnu.org; Thu, 29 Aug 2024 00:57:53 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sjXEF-0001Xc-Oa for help-gnu-emacs@gnu.org; Thu, 29 Aug 2024 00:57:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=3UXoB5Akp2x3/l+VEyYr9/ppjcFDudq30CxU6p9T8OU=; b=hKR5Msozg/4mnLFXbwD2yiaaHo MaS/v422iiJ9Gs+YhDgu5PEdoI4ioOX3EOrbd21DsnYpNCiXzyYdmkWwRXEvbzYbfziy5aQ8W7VIQ suBpWBy6LfHpkNs5TOcmLZ1wjcOJe61Elnxb9jXpsvDrMbNRMgHJQ1Bd0cRS1U2+6Jq+cQVjyujgv VImKPCFJpB81VhB/BIU1TPNRbvwK78E6/XkllmchGOB/L5i8KFeYuSRK21zVWZd+1dGUIWQSWUC+U LJBaziRSU8o+sXaVFLUs6waNbgrKOGw9dOpR0v+cVBi07cSPxojlB6br+g6opk6TbtuEkMflBRMo5 AXOTl0Og==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1sjXEC-0000Ag-10; Thu, 29 Aug 2024 06:57:48 +0200 Content-Disposition: inline In-Reply-To: <6a7b894c-8c00-482e-b75c-ce87c0eb2b9c@greatalpha.com> Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147847 Archived-At: --PsG+k05JywZ5+Z+K Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 28, 2024 at 01:01:33PM -0700, David Elson wrote: > Hello. I have been using emacs for ... a while. >=20 > For questions, I have often browsed and browsed (i.e. googled) and ... and > usually find a good explanation. But sometimes I don't find an answer, ev= en > when it is staring right at me. >=20 > My question: >=20 > To emulate something akin to the PL1/C/C++ arrow notation, I have used: >=20 > *(defun -> (object method &rest args) ...)* >=20 > and it works. >=20 > *Is this valid elisp/lisp?* It is. From the elisp documentation: -- Macro: defun name args [doc] [declare] [interactive] body... =E2=80=98defun=E2=80=99 is the usual way to define new Lisp functions.= It defines the symbol NAME as a function with argument list ARGS ... =2E.. so NAME is a symbol. Again, from the doc: A symbol name can contain any characters whatever. Most symbol names are written with letters, digits, and the punctuation characters =E2=80=98-+=3D*/=E2=80=99. Such names require no special punctuation; th= e characters of the name suffice as long as the name does not look like a number. (If it does, write a =E2=80=98\=E2=80=99 at the beginning of the name to force interpretation as a symbol.) The characters =E2=80=98_~!@$%^&:<>{}?=E2= =80=99 are less often used but also require no special punctuation. Any other characters may be included in a symbol=E2=80=99s name by escaping them wi= th a backslash. So "->" is not only a legal symbol name, but also one that doesn't need special escaping to be seen as such. So go wild :) Actually, Emacs Lisp comes with one function named "-" and another named ">". That said, this doesn't mean that other people will find your code readable or enjoyable. It's on you to find that out :-) > If it works only coincidentally, then it might break in the future, when a > pressing emacs issue is resolved in a manner that requires plugging this > "loophole". >=20 > If it is formally valid, where does it document the level of flexibility > that allows this syntax? The Emacs Lisp documentation should be your go-to place for such questions. Cheers --=20 t --PsG+k05JywZ5+Z+K Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZs//xQAKCRAFyCz1etHa RopJAJ9JP0ldE1q3cEEAnbKeM7GnWgaWfgCdEY0YoXYajSU8KbKfsbOAgYF/Oxs= =e6hd -----END PGP SIGNATURE----- --PsG+k05JywZ5+Z+K--