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: Fri, 10 May 2024 13:53:36 +0200

Hi

apologies for being such a PITA.

(defun foo (x y)
   (declare (ftype (function (integer number) number)))
   (+ x y))

Is fine with me, as long as the following is also valid.

(defun foo (x y)
   (declare (ftype (function (integer number) number) foo))
   (+ x y))

Of course, I can go even further (never said that ANSI CL is perfect).

(defun foo (x y)
   (declare (type integer x)
            (type number y)
            (values number))
  (+ x y))

This should tag the function in the same way (and note that values declaration is a CL extension).

All the best

MA


On Fri, May 10, 2024 at 12:21 PM Andrea Corallo <acorallo@gnu.org> wrote:
Marco Antoniotti <marco.antoniotti@unimib.it> writes:

> Dear Andrea
>
> The point is NOT to diverge from Common Lisp.  Such divergence is - IMHO - unwarranted.  Plus, the proposal for the ftype
> declaration also carries over to type declarations, which, again, are useful per se, even if the compiler is "smart
> enough" (ok; this one is for old-timers :) )
>
> Having said that, a provision can be made that a nameless ftype declaration at a function top level refers to the
> "definenda" function.  Again, having to use ftype instead of type is a consequence of ELisp being a 2-lisp.

Dear Marco,

I see your point and share the intent, given your provision 😃 for

(defun foo (x y)
   (declare (ftype (function (integer number) number)))
   (+ x y))

I'm personally okay with the change.

Eli Stefan WDYT?

Thanks

  Andrea


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