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: Wed, 8 May 2024 13:36:50 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000008f3c8f0617efb856" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7718"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Andrea Corallo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed May 08 13:42:01 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 1s4fgP-0001i5-Dt for ged-emacs-devel@m.gmane-mx.org; Wed, 08 May 2024 13:42:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4ffr-0001oS-Dl; Wed, 08 May 2024 07:41:27 -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 1s4fbf-0001FH-E1 for emacs-devel@gnu.org; Wed, 08 May 2024 07:37:08 -0400 Original-Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s4fbc-00027W-Mf for emacs-devel@gnu.org; Wed, 08 May 2024 07:37:07 -0400 Original-Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-51f99f9e0faso4681556e87.2 for ; Wed, 08 May 2024 04:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unimib.it; s=google; t=1715168221; x=1715773021; 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=at1cjKZ2x27266rcPlnAENlmsTB/Snv+O7ECfWCLau0=; b=ClnKQRM5U3/vpbrXiunk5DvZMpRx57N2ff7Tm9TZT0gxNsFxuLYM8qka+Vte00VdyP EIIqSzLebK9I8rkS5j7zH1xroDdNSrb79wKlKUMFDnpSvYbI/xQnSHHMpCOr6Nn3jSSX aDjBr4i/0Z8yWFY200zOjuwGsqmnqW3bTtz8DisFX2ehNSHM23FzNGvKGDUsM0nRdhZ8 gwIKLnb83ScziAumLZVMA/s7qcj90XiDFF/lLSrEJ6P9xgMBLR2Z2TNmgtWMIQNgNU7u fTnjCZmAIIXTbu3c1wv43NOdMMVU45eUvh7VetUraAdQ4otaDgl2606AssSy7RS34/hB Pn4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715168221; x=1715773021; 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=at1cjKZ2x27266rcPlnAENlmsTB/Snv+O7ECfWCLau0=; b=vEIkGKCbIhDQeGvlwXoSZ1o/aRLYTzXIwwWTwd6oaqvw7hKb/UYN+Zef8244BfKnOC NogHP0VEry6rx+U1XLMAf5bjmHgEb1GJNwl+VNVaKEOkdEshEVpNk7hAPGn8TAN5UAnb IX+NYmRn5i1kIbnkk3mvN13DLWx4uoXgjSQQuWI0dKk6h6uUQztZLCWLyO8LZUw0CP3h iZXo4PKE0W5sC8F9hZpGoWyrwr40/YBhoSc5Y9rMIkSgL1FYKyDzMS83JiV2wgPlBhW2 hDdWYSeiwQ8xew2NMIG/TfTYLkAx7/gBY9o03qM+wW+G8jyWFQABCEjFaAVpOIF4JczP GzFw== X-Gm-Message-State: AOJu0YzDepqeu6v7oJE0/lT4it5BO767Td8wuJWDypB2nFSGxWIKtzkM d/st6FBsOeZWnjQ+a6vgcEv/RbrpFPGC1bmct5YlMMnk4poEqEnq5SnbA+bnzBJ7AjZH6RpRou9 0lBPXpStC4U8ZsDVqPgj+V1O95KuF0sujvYhsig== X-Google-Smtp-Source: AGHT+IFsmahCZUICrG9KB799/j0j4t0me8/UovG+fCPE4irXMqjZvNTIUPGVG7MvYFJto5I+82jQ4SSsDjmUPahRNWg= X-Received: by 2002:a05:6512:539:b0:51b:bb0f:b43f with SMTP id 2adb3069b0e04-5217cc45928mr1594360e87.43.1715168221273; Wed, 08 May 2024 04:37:01 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::132; envelope-from=marco.antoniotti@unimib.it; helo=mail-lf1-x132.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: Wed, 08 May 2024 07:41:20 -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:318993 Archived-At: --0000000000008f3c8f0617efb856 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ciao Andrea The presentation I attended gave me the idea of "ranting talks" at the next ELS :) Having said so, I now think that, to save goat and cabbage, what you want i= s (defun foo (x y) (declare (*ftype* (function (integer number) number) *foo*)) (+ x y)) Common lispers can live with that. All the best MA On Tue, May 7, 2024 at 10:32=E2=80=AFPM Andrea Corallo w= rote: > Marco Antoniotti writes: > > > Hi > > > > I am at ELS 2024 in Vienna and I saw Andrea Corallo's presentation abou= t > the introduction of the > > > > (defun foo (x) > > (declare (type (function (integer) float)) > > (+ x 42.0)) > > > > declaration. > > > > 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 roa= d. > > > > The declaration proposed is for the signature of the function as a > whole. Using type may prevent ELisp from introducing > > the usual CL idiom, as the following one > > > > (let ((x 42) (y -1)) > > (declare (type integer x y)) ; The type declaration refers to names > x and y. > > ...) > > > > ... unless you special case the type declaration with no name(s) > following the type spec. > > > > My suggestion: keep type (and ftype) for doing things the CL way (which > was the PL/I way :) ) and introduce a signature > > spec to be meaningful only at the function toplevel. > > > > (defun foo (x) > > (declare (signature (function (integer) float)) > > (+ x 42.0)) > > > > All the best > > Ciao Marco, > > I've no problem changing 'type' for something different if there's > agreement, I don't especially like 'signature' as it's a bit verbose for > my taste (but I could leave with it). > > Thanks > > Andrea > > PS the presentation you attended must have been really terribile :) > --=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 --0000000000008f3c8f0617efb856 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ciao Andrea

The presentation= I attended gave me the idea of "ranting talks" at the next ELS := )

Having said so, I now think that, to save goat and cabb= age, what you want is

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

Common lispers can live = with that.

All the best

MA

On Tue, May 7, 2024 at 10:32=E2=80=AFPM Andrea Corallo <acorallo@gnu.org> wrote:
Marco Antoniotti <marco.antoniotti@unimib.i= t> writes:

> Hi
>
> I am at ELS 2024 in Vienna and I saw Andrea Corallo's presentation= about the introduction of the
>
> (defun foo (x)
>=C2=A0 =C2=A0 =C2=A0(declare (type (function (integer) float))
>=C2=A0 =C2=A0 =C2=A0(+ x 42.0))
>
> declaration.
>
> IMHO (and, I am not afraid to say, of many common lispers) this is sho= rtsighted and a rather gratuitous departure from
> what CL does.=C2=A0 With some potential unintended consequences down t= he road.
>
> The declaration proposed is for the signature of the function as a who= le.=C2=A0 Using type may prevent ELisp from introducing
> the usual CL idiom, as the following one
>
> (let ((x 42) (y -1))
>=C2=A0 =C2=A0 =C2=A0(declare (type integer x y)) ; The type declaration= refers to names x and y.
> ...)
>
> ... unless you special case the type declaration with no name(s) follo= wing the type spec.
>
> My suggestion: keep type (and ftype) for doing things the CL way (whic= h was the PL/I way :) ) and introduce a signature
> spec to be meaningful only at the function toplevel.
>
> (defun foo (x)
>=C2=A0 =C2=A0 =C2=A0(declare (signature (function (integer) float))
>=C2=A0 =C2=A0 =C2=A0(+ x 42.0))
>
> All the best

Ciao Marco,

I've no problem changing 'type' for something different if ther= e's
agreement, I don't especially like 'signature' as it's a bi= t verbose for
my taste (but I could leave with it).

Thanks

=C2=A0Andrea

PS the presentation you attended must have been really terribile :)


--
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
--0000000000008f3c8f0617efb856--