all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* (declare (type (function...
@ 2024-05-07 11:55 Marco Antoniotti
  2024-05-07 16:55 ` Tomas Hlavaty
  2024-05-07 20:32 ` Andrea Corallo
  0 siblings, 2 replies; 23+ messages in thread
From: Marco Antoniotti @ 2024-05-07 11:55 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1220 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2413 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2024-05-14 10:04 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-07 11:55 (declare (type (function Marco Antoniotti
2024-05-07 16:55 ` Tomas Hlavaty
2024-05-07 17:10   ` Marco Antoniotti
2024-05-07 17:38     ` Tomas Hlavaty
2024-05-07 17:52       ` Marco Antoniotti
2024-05-07 20:32 ` Andrea Corallo
2024-05-08  2:36   ` Emanuel Berg
2024-05-09  3:21     ` Tomas Hlavaty
2024-05-08  2:44   ` Emanuel Berg
2024-05-08 11:36   ` Marco Antoniotti
2024-05-09  3:33     ` Tomas Hlavaty
2024-05-09 13:19     ` Simon Leinen
2024-05-09 13:43       ` Emanuel Berg
2024-05-10  6:47     ` Andrea Corallo
2024-05-10  9:50       ` Marco Antoniotti
2024-05-10 10:21         ` Andrea Corallo
2024-05-10 11:53           ` Marco Antoniotti
2024-05-10 14:04           ` Stefan Monnier
2024-05-10 14:17             ` Marco Antoniotti
2024-05-11 10:29           ` Eli Zaretskii
2024-05-13 21:12             ` Andrea Corallo
2024-05-14  9:26               ` Andrea Corallo
2024-05-14 10:04                 ` Marco Antoniotti

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.