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: Tue, 7 May 2024 19:10:46 +0200 Message-ID: References: <87h6f98sus.fsf@neko.mail-host-address-is-not-set> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000f7f9540617e04460" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23861"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Tomas Hlavaty Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 07 20:32:44 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 1s4PcJ-0005ve-Kt for ged-emacs-devel@m.gmane-mx.org; Tue, 07 May 2024 20:32:44 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4Pbj-0001li-1D; Tue, 07 May 2024 14:32:07 -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 1s4OLH-0002Yi-68 for emacs-devel@gnu.org; Tue, 07 May 2024 13:11:03 -0400 Original-Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s4OLE-00088D-Dr for emacs-devel@gnu.org; Tue, 07 May 2024 13:11:02 -0400 Original-Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-51ab4ee9df8so4146638e87.1 for ; Tue, 07 May 2024 10:10:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unimib.it; s=google; t=1715101858; x=1715706658; 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=jC4axbRlShqZhvx7LzOJPMLwevc6lns4MEIyPLbxJUw=; b=ZDQELk7VjgUVxTK3l08riHm6WDJwj+ngUEMRQqEYm/qZERHdGmKmW86be+d3ybYOql 4YEK/6VYq9Wkuveodb6g87UfZkqguznfdZUqVA+CeLfrcwwUdHbb9fgMgquxN2aCM0mu tUoYM1qO3Px8MpPnKG6npDRzRdAUpZSl5M12Jx8Kbi0fsLBGs9dvbGb3WtAtdoO/KY35 XM5+OMmFFjtQk15ZmT6znETy67O5vsVUrRiTFhJBb1L/xLOLIuuvFn5ZmikUeL4M+Vdg 4/catZeK1ejr0r6zNzbO1Xpy1IDkTItRCyPuM8VVRE7kL9Ytfi3Ialiy5SpD1DNsq2Sh Pqvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715101858; x=1715706658; 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=jC4axbRlShqZhvx7LzOJPMLwevc6lns4MEIyPLbxJUw=; b=lNdd+yKYAZXx9sK0VOQkVZu3fALeqN3coDALYGLi18hq+F5PzoATsWlXiYCUvjofTO DBDauPNFa4yiOT46LRSnI4M2runtBwFU64QlgMiXYmuDqsfPWdsudUHXWgoQN3v9xfqb 4/03Bj08Dr/TuAnb7sHwGGwg5uwCKhzzYDcxkXuqJ5i1U3CO7ztDP6UYRTU2vgFUUpqt cyQVIQLg4ThyAkdva7SaI4U8c3A9m+ZE8OVjE2qkCglQPfH20JtGjellypA6ZllGymXj +pRpA899lgHxjRtufCJ/nVnfTvSeuPeWrm/lH0WxE2VdGdzXxNQ20sa3+6oU6JXylPNF 8MqQ== X-Gm-Message-State: AOJu0Yzb4g+zPNfMGpnZ/ZfKUJyI1b5pCv1d+Y4EmnoAiVmFcC/K8dtB sHC3BfX8zkdy4fEhIW3A/RN+dTtL04Z0RXuXtrvjcnHFXLBInnEoVcITfhtfwDTNroykzTq+1EV cai7NBtpsIx+NE2h7BrAVyZUJRW1zevTaJvubZw== X-Google-Smtp-Source: AGHT+IHkZGF0cwoJvs1CUfoKajTZpIkRlcOfQlOpM5YbiARCflOGYth1bw/GL1ZBmBKEZyHqVge4xfzLKaBXl2kKOKQ= X-Received: by 2002:a19:f613:0:b0:51f:d790:2462 with SMTP id 2adb3069b0e04-5217c667531mr83941e87.39.1715101857470; Tue, 07 May 2024 10:10:57 -0700 (PDT) In-Reply-To: <87h6f98sus.fsf@neko.mail-host-address-is-not-set> Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=marco.antoniotti@unimib.it; helo=mail-lf1-x136.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: Tue, 07 May 2024 14:31:59 -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:318969 Archived-At: --000000000000f7f9540617e04460 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi pardon me, but grep type.... would yield many more hits, and I do not understand why this is relevant to the issue. The points are two: (1) gratuitous difference from Common Lisp (*) and (2) potential issues with down the road useful and rather obvious uses of declare forms (cfr., the let example). Granted (1) can be "documented away", by saying that type declarations at the top level are "special", but (2) should be taken into consideration. Having said that, I think that signature or funsig or something other than type, conveying the actual meaning of that specific declaration would be better. Or this could be dealt with as in (defun *foo* (x) (declare (*ftype* (function (integer) float) *foo*)) (+ x 42.0)) IMHO, it makes more sense to the Common Lisper. After all, ELisp is a 2-Lisp. All the best MA On Tue, May 7, 2024 at 6:55=E2=80=AFPM Tomas Hlavaty wrote= : > On Tue 07 May 2024 at 13:55, Marco Antoniotti > wrote: > > IMHO (and, I am not afraid to say, of many common lispers) this is > > shortsighted and a rather gratuitous departure from what CL does. With > > some potential unintended consequences down the road. > > There was a discussion about this. > > id:yp15xyf88yb.fsf@fencepost.gnu.org > Andrea Corallo (February 23) () > Subject: Declaring Lisp function types > To: emacs-devel@gnu.org > Date: Fri, 23 Feb 2024 11:02:52 -0500 > > also > > id:jwv4jdne65n.fsf-monnier+emacs@gnu.org > Stefan Monnier (March 03) () > Subject: Re: Declaring Lisp function types > To: Andrea Corallo > Cc: "Stefan Monnier via Emacs development discussions." < > emacs-devel@gnu.org> > Date: Sun, 03 Mar 2024 09:52:23 -0500 > [...] > Then I'd go with > (declare (type (function ..))) > [...] > > > (defun foo (x) > > *(declare (signature (function (integer) float))* > > (+ x 42.0)) > > grep signature ~/mr/emacs would yield lots of false positives > > function-signature or something like that would be better name. > but this was also discussed already. > --=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 --000000000000f7f9540617e04460 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

pardon me, but

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 grep type....

would yield many more hits,= and I do not understand why this is relevant to the issue.

The points are two: (1) gratuitous difference from Common Lisp (*) and (= 2) potential issues with down the road useful and rather obvious uses of de= clare forms (cfr., the let exa= mple).

Granted (1) can be "documented away", by= saying that type declarations at the top level are "special", bu= t (2) should be taken into=C2=A0consideration.

Having sai= d that, I think that signature= or funsig or something other than ty= pe, conveying the actual meaning of that specific declaration would = be better.=C2=A0 Or this could be dealt with as in

(defun foo (x)
= =C2=A0=C2=A0=C2=A0 (declare (ftype= (function (integer) float) foo))
=C2=A0=C2=A0=C2=A0 (+ x 42.0))

IMHO, it makes more sense to the Common Lisper.=C2=A0 Afte= r all, ELisp is a 2-Lisp.

All the best

MA





<= div class=3D"gmail_quote">
On Tue, May= 7, 2024 at 6:55=E2=80=AFPM Tomas Hlavaty <tom@logand.com> wrote:
On Tue 07 May 2024 at 13:55, Marco Antoniotti <marco.antoniotti@= unimib.it> wrote:
> IMHO (and, I am not afraid to say, of many common lispers) this is
> shortsighted and a rather gratuitous departure from what CL does.=C2= =A0 With
> some potential unintended consequences down the road.

There was a discussion about this.

id:yp15xyf88yb.fsf@fencepost.gnu.org
Andrea Corallo <ac= orallo@gnu.org> (February 23) ()
Subject: Declaring Lisp function types
To: emacs-devel@gn= u.org
Date: Fri, 23 Feb 2024 11:02:52 -0500

also

id:jwv4jdne65n.fsf-monnier+emacs@gnu.org
Stefan Monnier <monnier@iro.umontreal.ca> (March 03) ()
Subject: Re: Declaring Lisp function types
To: Andrea Corallo <acorallo@gnu.org>
Cc: "Stefan Monnier via Emacs development discussions." <emacs-devel@gnu.org= >
Date: Sun, 03 Mar 2024 09:52:23 -0500
[...]
Then I'd go with
(declare (type (function ..)))
[...]

> (defun foo (x)
>=C2=A0 =C2=A0 =C2=A0*(declare (signature (function (integer) float))* >=C2=A0 =C2=A0 =C2=A0(+ x 42.0))

grep signature ~/mr/emacs would yield lots of false positives

function-signature or something like that would be better name.
but this was also discussed already.


--
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
--000000000000f7f9540617e04460--