From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Marco Antoniotti Newsgroups: gmane.emacs.devel Subject: Re: (declare (type (function... Date: Fri, 10 May 2024 13:53:36 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000037ca650618183090" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12451"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Eli Zaretskii , Stefan Monnier To: Andrea Corallo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 10 17:11:57 2024 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 1s5Rud-0002yB-3y for ged-emacs-devel@m.gmane-mx.org; Fri, 10 May 2024 17:11:55 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5Ru2-0003r3-BZ; Fri, 10 May 2024 11:11:18 -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 1s5Op0-0008Oa-1j for emacs-devel@gnu.org; Fri, 10 May 2024 07:53:54 -0400 Original-Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5Oox-0001r8-Iu for emacs-devel@gnu.org; Fri, 10 May 2024 07:53:53 -0400 Original-Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2e3e1ad0b19so24534041fa.0 for ; Fri, 10 May 2024 04:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unimib.it; s=google; t=1715342028; x=1715946828; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=yHYsVbxqLOhpE8tSC/PXA4drPz6v/lupgstod+6cPeM=; b=TUOagHAmzr4btcQHEnDnAQpH4nXL06X85I/wrsojWmV1qcDm2scBWR8a0NEr7uSlzs NLk9kJPmvV02pp/N1G4omJnNpJUaV9PsZiNPqfw/IOC30wQWBZ49GIfTvUG14Kab6fXB +Qr51ehac0spb/CAXwhmfxR8LuM8QcwQIKHYRdkp4vVmLWWvMZcSATgQ7gg3hV2EPE2M Fl8ztQubVnFWWB2+2feXoDLA6fgbTGV8F8q5NH7OfMHgGvLyv5FPz4Wsch8P7k6Xdmid Xmes6+dp8qKnocCfPmkr4r4BPL0pYJ5OB/rjbFLFrusJ3Mm6aJGJn/8qnK45SgrfF8ip oXUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715342028; x=1715946828; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yHYsVbxqLOhpE8tSC/PXA4drPz6v/lupgstod+6cPeM=; b=QxAM8XlS0FBMiwNe6Etuin6Jp7WyE23pkFeizdPyJailvxj6X2vx3ox291o9YVCd6x qzVtrUNPzyagnxFqC9a6JQWwJMaiuQ0Ipk0zCIoD/T4y3OamX6JF6QqA2cKE8/mPbYcE e5JlEaCbTCbOdSHHxtoM/o9UwZWBPYjISVeYeatJ39AFvnWgkpnM6lzeypOcYiFfj5gG zUukcf0iVll9r3x5/Uxo1fbQNuiOV0C4ePpTV93ZuclcKVQTP9nNfJYPVxymwUcUeFHt hjy4uvuHj1hUGA4PXzVUWDMMp5WGqAKsOablY/EVHBsdAUjGNHyDRYr9e5r+mB93lhz5 Ri0w== X-Gm-Message-State: AOJu0YyS0wzPPUiSXfLApVnxkB5gIMW3Alu3gDyfksNxHit/KT24ki69 p07kT9Tj4qXgyH78pTzPEerCz2WARqi9Kg0IbpeGij7S40RL+ODsVX/wBa8EiKoGCoGGUu65aih zI2B2T0BYoxHru9cXqCTii/Y41bndPXxLUXwvdzd9mt9VUOXYkI2V4w== X-Google-Smtp-Source: AGHT+IHXHUPGgzxZO3htFxn1KaCyuzp70Ko1Xr+fVeAeLJjwVI26Du1g8KkNup4YolquJUGmdYM961Wag1JO8fX1XM8= X-Received: by 2002:a05:651c:2116:b0:2df:6fd5:1475 with SMTP id 38308e7fff4ca-2e51ff4eb08mr19330451fa.28.1715342027499; Fri, 10 May 2024 04:53:47 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::234; envelope-from=marco.antoniotti@unimib.it; helo=mail-lj1-x234.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, HTML_MESSAGE=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-Mailman-Approved-At: Fri, 10 May 2024 11:11:17 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:319144 Archived-At: --00000000000037ca650618183090 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi apologies for being such a PITA. (defun foo (x y) (declare (*ftype* (function (integer number) number))) (+ x y)) Is fine with me, as long as the following is also valid. (defun foo (x y) (declare (*ftype* (function (integer number) number) *foo*)) (+ x y)) Of course, I can go even further (never said that ANSI CL is perfect). (defun foo (x y) (declare (*type* integer x) (*type* number y) (*values* number)) (+ x y)) This should tag the function in the same way (and note that *values* declaration is a CL extension). All the best MA On Fri, May 10, 2024 at 12:21=E2=80=AFPM Andrea Corallo = wrote: > Marco Antoniotti writes: > > > Dear Andrea > > > > The point is NOT to diverge from Common Lisp. Such divergence is - IMH= O > - unwarranted. Plus, the proposal for the ftype > > declaration also carries over to type declarations, which, again, are > useful per se, even if the compiler is "smart > > enough" (ok; this one is for old-timers :) ) > > > > Having said that, a provision can be made that a nameless ftype > declaration at a function top level refers to the > > "definenda" function. Again, having to use ftype instead of type is a > consequence of ELisp being a 2-lisp. > > Dear Marco, > > I see your point and share the intent, given your provision =F0=9F=98=83 = for > > (defun foo (x y) > (declare (ftype (function (integer number) number))) > (+ x y)) > > I'm personally okay with the change. > > Eli Stefan WDYT? > > Thanks > > Andrea > --=20 Marco Antoniotti, Professor tel. +39 - 02 64 48 79 01 DISCo, University of Milan-Bicocca U14 2043 http://dcb.disco.unimib.it Viale Sarca 336 I-20126 Milan (MI) ITALY --00000000000037ca650618183090 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

apologies for being such = a PITA.

(def= un foo (x y)
=C2=A0 =C2=A0(declare (ftype (function (integer number) number))) =C2=A0 =C2=A0(+ x y))

Is fine with me, as l= ong as the following is also valid.

(defun foo (x y)
=C2=A0 =C2=A0(declare (ftype (function (integer number) number) f= oo))
=C2=A0 =C2=A0(+ x y))

Of course, I can go e= ven further (never said that ANSI CL is perfect).

(defun foo (x y)
=C2=A0 =C2=A0(declare (type integer x)
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (type number y)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (values number))
=C2=A0 (= + x y))

This should tag the function in the= same way (and note that values declaration is a CL extension).

All the b= est

MA


On Fri, May 10, 202= 4 at 12:21=E2=80=AFPM Andrea Corallo <acorallo@gnu.org> wrote:
Marco Antoniotti <marco.antoniotti@unimib.it> writes:

> Dear Andrea
>
> The point is NOT to diverge from Common Lisp.=C2=A0 Such divergence is= - IMHO - unwarranted.=C2=A0 Plus, the proposal for the ftype
> declaration also carries over to type declarations, which, again, are = useful per se, even if the compiler is "smart
> enough" (ok; this one is for old-timers :) )
>
> Having said that, a provision can be made that a nameless ftype declar= ation at a function top level refers to the
> "definenda" function.=C2=A0 Again, having to use ftype inste= ad of type is a consequence of ELisp being a 2-lisp.

Dear Marco,

I see your point and share the intent, given your provision =F0=9F=98=83 fo= r

(defun foo (x y)
=C2=A0 =C2=A0(declare (ftype (function (integer number) number)))
=C2=A0 =C2=A0(+ x y))

I'm personally okay with the change.

Eli Stefan WDYT?

Thanks

=C2=A0 Andrea


--
Marco Antoniotti, Professor=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 tel. +39 - 02 64 48 79 01
DISCo, University = of Milan-Bicocca U14 2043=C2=A0=C2=A0 http://dcb.disco.unimib.it
Viale Sarca 336
I-= 20126 Milan (MI) ITALY
--00000000000037ca650618183090--