emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (declare (type (function...


From: Marco Antoniotti
Subject: Re: (declare (type (function...
Date: Wed, 8 May 2024 13:36:50 +0200

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 is

(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 PM Andrea Corallo <acorallo@gnu.org> wrote:
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 :)


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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]