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: (declare (type (function... Date: Tue, 7 May 2024 13:55:06 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000000915f70617dbdc95" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21985"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 07 15:09:54 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 1s4KZu-0005Qi-4k for ged-emacs-devel@m.gmane-mx.org; Tue, 07 May 2024 15:09:54 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4KZH-0004Zp-9j; Tue, 07 May 2024 09:09:15 -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 1s4JPn-0002L6-KB for emacs-devel@gnu.org; Tue, 07 May 2024 07:55:24 -0400 Original-Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s4JPl-0005yv-4h for emacs-devel@gnu.org; Tue, 07 May 2024 07:55:23 -0400 Original-Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2dcc8d10d39so33580721fa.3 for ; Tue, 07 May 2024 04:55:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unimib.it; s=google; t=1715082917; x=1715687717; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=RZCCoSHL1jta4WwCqXUrdmbJQuiIOOOuTV5gjmUweBo=; b=JLGKoe4TPWBEvgGrnC4wWanFDxE8g2c2Sl/z266bJCgHo7pdWgGvaMGpzsI4t/umm7 P7OkLQKllGp8eaDT+hM60BQMqZ/wS6BIhBC09XVLLVDsAnAr31WoyfIs+dkVqVVAVL/6 ixBXjgo8YcUJ8t4OkPBXiq+zSsG9j0A6E4mzsCm/l3+j47KZ5qGlJOH2SUXPuDvgVapH FFPihmDGa8numxgD+iFYIN+Z3XA4jnjeu+gpwLIfBq2UOWM0ZlaZ7/00MiMe9hm773hH H/fshdF7cYqeqUkjhhkeuBU/DukWMM0IfjNfI+SgOlvWmfkLA1/RNYmBNwH5Lbnjr9eN ZQiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715082917; x=1715687717; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=RZCCoSHL1jta4WwCqXUrdmbJQuiIOOOuTV5gjmUweBo=; b=NpXmsVSoLToVxDpg/yqYHWojuzE+t1l24KZ3tMY1565A0WzPScq89e7PQ4ZB6cNgh6 KvoEO72sGZ2cNvY9HJUpTp0WJe/TI/R4E6akBy6G6ztgUoxjAPoFYYnNEXtUpqYotCcu ZsTxy3mOBbXGUKMtXJ4I7PeIH1JNH2mxil+OPMHbJOvJILwsrlJpPryrNc9y30upHqwU iv8Vixr1uD3YjSiTmUM1h0ea5U1JejHVYayneyL0gmDeqAcbVISMPlaFt7f69wLy4K7P uoF6+X1wQDQy4S7j1X58/rcnuxky01HADa6BJecBrL9ejPhIEeeNLp/Q/qi2oujddSfW /Q1A== X-Gm-Message-State: AOJu0YzGjW4yrY6TGH6C9nzj4qMsd+3aVY+HzjJuJdDB1yLKg6nj6gX9 YAO5uAWBVM4IrdP1UA64atX7dx2Z0T3jxOjRi80UnUMnl+1+U4chNx59GDHF7Wj7+l6nnT/Ixbm V2QszHtdZm5SHC5Nx3dUUMIsykLPGfoKe2L6gHCkYQjBsEJMSURVoI8qi X-Google-Smtp-Source: AGHT+IEzDO7ZCvP5L5qHlyrHEtQDyxp26MPICcnOWlt1iT/0uCAjS01xK/DX5hcJl9rjn3pZ6JG5G5nqiEdACA3efRc= X-Received: by 2002:a2e:9ad7:0:b0:2e0:e470:882f with SMTP id p23-20020a2e9ad7000000b002e0e470882fmr10076295ljj.28.1715082917118; Tue, 07 May 2024 04:55:17 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::233; envelope-from=marco.antoniotti@unimib.it; helo=mail-lj1-x233.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 09:09:12 -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:318943 Archived-At: --0000000000000915f70617dbdc95 Content-Type: text/plain; charset="UTF-8" Hi I am at ELS 2024 in Vienna and I saw Andrea Corallo's presentation about 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 road. 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 -- 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 --0000000000000915f70617dbdc95 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 (dec= lare (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 shortsighted and a rather gratuitous depa= rture from what CL does.=C2=A0 With some potential unintended consequences = down the road.

The declaration proposed is for the sig= nature of the function as a whole.=C2=A0 Using type may prevent ELisp f= rom 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 declar= ation refers to names x and y.
...)

... unless you speci= al case the type declaration w= ith no name(s) following the type spec.

My suggestion: ke= ep type (and ftype) for doing things the CL way (which was t= he PL/I way :) ) and introduce a signature spec to be meaningful only at th= e function toplevel.

(def= un 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
--
= 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-201= 26 Milan (MI) ITALY
--0000000000000915f70617dbdc95--