|
From: | Marco Antoniotti |
Subject: | Re: (declare (type (function... |
Date: | Wed, 8 May 2024 13:36:50 +0200 |
Marco Antoniotti <marco.antoniotti@unimib.it> writes:
> 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
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 :)
[Prev in Thread] | Current Thread | [Next in Thread] |