unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Marco Antoniotti <marco.antoniotti@unimib.it>
To: Andrea Corallo <acorallo@gnu.org>
Cc: emacs-devel@gnu.org, Eli Zaretskii <eliz@gnu.org>,
	 Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: (declare (type (function...
Date: Fri, 10 May 2024 13:53:36 +0200	[thread overview]
Message-ID: <CAG0Nw2nv=2bW1j4JSnoS+WTyVLJL1z3boFqAhPnYxYYUudNAOA@mail.gmail.com> (raw)
In-Reply-To: <yp14jb6vufy.fsf@fencepost.gnu.org>

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

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

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

  reply	other threads:[~2024-05-10 11:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAG0Nw2nv=2bW1j4JSnoS+WTyVLJL1z3boFqAhPnYxYYUudNAOA@mail.gmail.com' \
    --to=marco.antoniotti@unimib.it \
    --cc=acorallo@gnu.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).