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