all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* (declare (type (function...
@ 2024-05-07 11:55 Marco Antoniotti
  2024-05-07 16:55 ` Tomas Hlavaty
  2024-05-07 20:32 ` Andrea Corallo
  0 siblings, 2 replies; 23+ messages in thread
From: Marco Antoniotti @ 2024-05-07 11:55 UTC (permalink / raw)
  To: emacs-devel

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

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

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  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 20:32 ` Andrea Corallo
  1 sibling, 1 reply; 23+ messages in thread
From: Tomas Hlavaty @ 2024-05-07 16:55 UTC (permalink / raw)
  To: Marco Antoniotti, emacs-devel

On Tue 07 May 2024 at 13:55, Marco Antoniotti <marco.antoniotti@unimib.it> wrote:
> 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.

There was a discussion about this.

id:yp15xyf88yb.fsf@fencepost.gnu.org
Andrea Corallo <acorallo@gnu.org> (February 23) ()
Subject: Declaring Lisp function types
To: emacs-devel@gnu.org
Date: Fri, 23 Feb 2024 11:02:52 -0500

also

id:jwv4jdne65n.fsf-monnier+emacs@gnu.org
Stefan Monnier <monnier@iro.umontreal.ca> (March 03) ()
Subject: Re: Declaring Lisp function types
To: Andrea Corallo <acorallo@gnu.org>
Cc: "Stefan Monnier via Emacs development discussions." <emacs-devel@gnu.org>
Date: Sun, 03 Mar 2024 09:52:23 -0500
[...]
Then I'd go with
(declare (type (function ..)))
[...]

> (defun foo (x)
>     *(declare (signature (function (integer) float))*
>     (+ x 42.0))

grep signature ~/mr/emacs would yield lots of false positives

function-signature or something like that would be better name.
but this was also discussed already.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-07 16:55 ` Tomas Hlavaty
@ 2024-05-07 17:10   ` Marco Antoniotti
  2024-05-07 17:38     ` Tomas Hlavaty
  0 siblings, 1 reply; 23+ messages in thread
From: Marco Antoniotti @ 2024-05-07 17:10 UTC (permalink / raw)
  To: Tomas Hlavaty; +Cc: emacs-devel

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

Hi

pardon me, but

      grep type....

would yield many more hits, and I do not understand why this is relevant to
the issue.

The points are two: (1) gratuitous difference from Common Lisp (*) and (2)
potential issues with down the road useful and rather obvious uses of
declare forms (cfr., the let example).

Granted (1) can be "documented away", by saying that type declarations at
the top level are "special", but (2) should be taken into consideration.

Having said that, I think that signature or funsig or something other than
type, conveying the actual meaning of that specific declaration would be
better.  Or this could be dealt with as in

(defun *foo* (x)
    (declare (*ftype* (function (integer) float) *foo*))
    (+ x 42.0))

IMHO, it makes more sense to the Common Lisper.  After all, ELisp is a
2-Lisp.

All the best

MA





On Tue, May 7, 2024 at 6:55 PM Tomas Hlavaty <tom@logand.com> wrote:

> On Tue 07 May 2024 at 13:55, Marco Antoniotti <marco.antoniotti@unimib.it>
> wrote:
> > 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.
>
> There was a discussion about this.
>
> id:yp15xyf88yb.fsf@fencepost.gnu.org
> Andrea Corallo <acorallo@gnu.org> (February 23) ()
> Subject: Declaring Lisp function types
> To: emacs-devel@gnu.org
> Date: Fri, 23 Feb 2024 11:02:52 -0500
>
> also
>
> id:jwv4jdne65n.fsf-monnier+emacs@gnu.org
> Stefan Monnier <monnier@iro.umontreal.ca> (March 03) ()
> Subject: Re: Declaring Lisp function types
> To: Andrea Corallo <acorallo@gnu.org>
> Cc: "Stefan Monnier via Emacs development discussions." <
> emacs-devel@gnu.org>
> Date: Sun, 03 Mar 2024 09:52:23 -0500
> [...]
> Then I'd go with
> (declare (type (function ..)))
> [...]
>
> > (defun foo (x)
> >     *(declare (signature (function (integer) float))*
> >     (+ x 42.0))
>
> grep signature ~/mr/emacs would yield lots of false positives
>
> function-signature or something like that would be better name.
> but this was also discussed already.
>


-- 
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: 4146 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-07 17:10   ` Marco Antoniotti
@ 2024-05-07 17:38     ` Tomas Hlavaty
  2024-05-07 17:52       ` Marco Antoniotti
  0 siblings, 1 reply; 23+ messages in thread
From: Tomas Hlavaty @ 2024-05-07 17:38 UTC (permalink / raw)
  To: Marco Antoniotti; +Cc: emacs-devel

On Tue 07 May 2024 at 19:10, Marco Antoniotti <marco.antoniotti@unimib.it> wrote:
> pardon me, but
>
>       grep type....
>
> would yield many more hits

yes, it is always possible to find even worse name to grep

> , and I do not understand why this is relevant to the issue.

don't you search source code?

I just pointed out that your suggested name could be even better.

> The points are two:

I understand that and agree with you.

I just sent to you links to the discussion.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-07 17:38     ` Tomas Hlavaty
@ 2024-05-07 17:52       ` Marco Antoniotti
  0 siblings, 0 replies; 23+ messages in thread
From: Marco Antoniotti @ 2024-05-07 17:52 UTC (permalink / raw)
  To: Tomas Hlavaty; +Cc: emacs-devel

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

Sorry if I misread your message.

All the best

MA


On Tue, May 7, 2024, 19:38 Tomas Hlavaty <tom@logand.com> wrote:

> On Tue 07 May 2024 at 19:10, Marco Antoniotti <marco.antoniotti@unimib.it>
> wrote:
> > pardon me, but
> >
> >       grep type....
> >
> > would yield many more hits
>
> yes, it is always possible to find even worse name to grep
>
> > , and I do not understand why this is relevant to the issue.
>
> don't you search source code?
>
> I just pointed out that your suggested name could be even better.
>
> > The points are two:
>
> I understand that and agree with you.
>
> I just sent to you links to the discussion.
>

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-07 11:55 (declare (type (function Marco Antoniotti
  2024-05-07 16:55 ` Tomas Hlavaty
@ 2024-05-07 20:32 ` Andrea Corallo
  2024-05-08  2:36   ` Emanuel Berg
                     ` (2 more replies)
  1 sibling, 3 replies; 23+ messages in thread
From: Andrea Corallo @ 2024-05-07 20:32 UTC (permalink / raw)
  To: Marco Antoniotti; +Cc: emacs-devel

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



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  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
  2 siblings, 1 reply; 23+ messages in thread
From: Emanuel Berg @ 2024-05-08  2:36 UTC (permalink / raw)
  To: emacs-devel

Andrea Corallo wrote:

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

I think "signature" is extremely old school, by now completely
unintuitive terminology to everyone but a precious few.

But gpt4 sticks with it, so maybe?

Q: What is the difference between function declaration,
   prototype, and signature?
            
A: Function declaration defines the function, prototype
   declares its existence, and signature specifies its inputs
   and outputs.

As for greping source, searching code in buffers for unique
strings etc - and just in general - when something new and
fancy is introduced, it is always a good idea to give it a new
and fancy and, optimally, unique name. But if there isn't such
a name that makes sense in terms of technology it is also
never wrong to just call it whatever it is.

Maybe one can combine two words, declare type, type signature
... You can use apropos to see if you get any hits. It'll be
more cryptic but also unique and more cool in a way B)
`tsig' :)

BTW, in Python, there is a function signature concept that
isn't equal to this type signature concept.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-07 20:32 ` Andrea Corallo
  2024-05-08  2:36   ` Emanuel Berg
@ 2024-05-08  2:44   ` Emanuel Berg
  2024-05-08 11:36   ` Marco Antoniotti
  2 siblings, 0 replies; 23+ messages in thread
From: Emanuel Berg @ 2024-05-08  2:44 UTC (permalink / raw)
  To: emacs-devel

Andrea Corallo wrote:

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

I think signature is also misleading as it does not uniquely
identify a function.

Anymore I was about to say?

Maybe at some point in computing history functions didn't have
names, they where just identified by their mappings from
a combination of types to a return type.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-07 20:32 ` Andrea Corallo
  2024-05-08  2:36   ` Emanuel Berg
  2024-05-08  2:44   ` Emanuel Berg
@ 2024-05-08 11:36   ` Marco Antoniotti
  2024-05-09  3:33     ` Tomas Hlavaty
                       ` (2 more replies)
  2 siblings, 3 replies; 23+ messages in thread
From: Marco Antoniotti @ 2024-05-08 11:36 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: emacs-devel

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

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

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-08  2:36   ` Emanuel Berg
@ 2024-05-09  3:21     ` Tomas Hlavaty
  0 siblings, 0 replies; 23+ messages in thread
From: Tomas Hlavaty @ 2024-05-09  3:21 UTC (permalink / raw)
  To: Emanuel Berg, emacs-devel

On Wed 08 May 2024 at 04:36, Emanuel Berg <incal@dataswamp.org> wrote:
> Andrea Corallo wrote:
>> 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).
>
> I think "signature" is extremely old school, by now completely
> unintuitive terminology to everyone but a precious few.

function-signature is already an established concept in emacs:

find -H . -type d \( -path \*/SCCS -o -path \*/RCS -o -path \*/CVS -o -path \*/MCVS -o -path \*/.src -o -path \*/.svn -o -path \*/.git -o -path \*/.hg -o -path \*/.bzr -o -path \*/_MTN -o -path \*/_darcs -o -path \*/\{arch\} \) -prune -o \! -type d \( -name .\#\* -o -name \*.o -o -name \*\~ -o -name \*.bin -o -name \*.lbin -o -name \*.so -o -name \*.a -o -name \*.ln -o -name \*.blg -o -name \*.bbl -o -name \*.elc -o -name \*.lof -o -name \*.glo -o -name \*.idx -o -name \*.lot -o -name \*.fmt -o -name \*.tfm -o -name \*.class -o -name \*.fas -o -name \*.lib -o -name \*.mem -o -name \*.x86f -o -name \*.sparcf -o -name \*.dfsl -o -name \*.pfsl -o -name \*.d64fsl -o -name \*.p64fsl -o -name \*.lx64fsl -o -name \*.lx32fsl -o -name \*.dx64fsl -o -name \*.dx32fsl -o -name \*.fx64fsl -o -name \*.fx32fsl -o -name \*.sx64fsl -o -name \*.sx32fsl -o -name \*.wx64fsl -o -name \*.wx32fsl -o -name \*.fasl -o -name \*.ufsl -o -name \*.fsl -o -name \*.dxl -o -name \*.lo -o -name \*.la -o -name \*.gmo -o -name \*.mo -o -name \*.toc -o -name \*.aux -o -name \*.cp -o -name \*.fn -o -name \*.ky -o -name \*.pg -o -name \*.tp -o -name \*.vr -o -name \*.cps -o -name \*.fns -o -name \*.kys -o -name \*.pgs -o -name \*.tps -o -name \*.vrs -o -name \*.pyc -o -name \*.pyo \) -prune -o  -type f \( -name \*.\* \) -exec grep --color=auto -i -nH --null -e function-signature \{\} +
./lisp/emacs-lisp/bytecomp.el1486:(defun byte-compile--function-signature (f)
./lisp/emacs-lisp/bytecomp.el1571:         (sig (cond (def (byte-compile--function-signature def))
./lisp/emacs-lisp/bytecomp.el1708:      (let ((sig1 (byte-compile--function-signature old))
./lisp/progmodes/octave.el1593:(defun octave-eldoc-function-signatures (fn)
./lisp/progmodes/octave.el1641:           (sigs (and fn (octave-eldoc-function-signatures fn)))
./lisp/ChangeLog.1722998:	(octave-eldoc-function-signatures, octave-help)
./lisp/ChangeLog.1724611:	(octave-eldoc-function-signatures, octave-eldoc-function):
./test/lisp/emacs-lisp/bytecomp-tests.el1156: "warn-wide-docstring-ignore-function-signature.el"
./ChangeLog.350951:	* lisp/progmodes/octave.el (octave-eldoc-function-signatures): Use
./ChangeLog.3170940:	* lisp/progmodes/octave.el (octave-eldoc-function-signatures): Fix the
./ChangeLog.3171565:	byte-compile--function-signature, it fails to compile code which
./ChangeLog.3194592:	* lisp/emacs-lisp/bytecomp.el (byte-compile--function-signature): New fun.
./ChangeLog.3194596:	since bytecode functions are now handled in byte-compile--function-signature.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-08 11:36   ` Marco Antoniotti
@ 2024-05-09  3:33     ` Tomas Hlavaty
  2024-05-09 13:19     ` Simon Leinen
  2024-05-10  6:47     ` Andrea Corallo
  2 siblings, 0 replies; 23+ messages in thread
From: Tomas Hlavaty @ 2024-05-09  3:33 UTC (permalink / raw)
  To: Marco Antoniotti, Andrea Corallo; +Cc: emacs-devel

On Wed 08 May 2024 at 13:36, Marco Antoniotti <marco.antoniotti@unimib.it> wrote:
> 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.

also

type:
(rg "~/mr/emacs" "\\(type" "-i")
Grep finished with 2912 matches found
not good

ftype
(rg "~/mr/emacs" "\\(ftype" "-i")
Grep finished with 27 matches found
much better



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  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
  2 siblings, 1 reply; 23+ messages in thread
From: Simon Leinen @ 2024-05-09 13:19 UTC (permalink / raw)
  To: Marco Antoniotti; +Cc: Emacs developers

On Wed, May 8, 2024 at 1:41 PM Marco Antoniotti
<marco.antoniotti@unimib.it> wrote:
> 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.

Yes, please :-)

(When I programmed in Common Lisp, I used (declaim (ftype ...) ...)
all the time.)

Cheers,
-- 
Simon.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-09 13:19     ` Simon Leinen
@ 2024-05-09 13:43       ` Emanuel Berg
  0 siblings, 0 replies; 23+ messages in thread
From: Emanuel Berg @ 2024-05-09 13:43 UTC (permalink / raw)
  To: emacs-devel

Simon Leinen wrote:

>> (defun foo (x y)
>>    (declare (ftype (function (integer number) number) foo))
>>    (+ x y))
>>
>> Common lispers can live with that.
>
> Yes, please :-)

Maybe it is time for a new language called Exceptional Lisp.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-08 11:36   ` Marco Antoniotti
  2024-05-09  3:33     ` Tomas Hlavaty
  2024-05-09 13:19     ` Simon Leinen
@ 2024-05-10  6:47     ` Andrea Corallo
  2024-05-10  9:50       ` Marco Antoniotti
  2 siblings, 1 reply; 23+ messages in thread
From: Andrea Corallo @ 2024-05-10  6:47 UTC (permalink / raw)
  To: Marco Antoniotti; +Cc: emacs-devel

Marco Antoniotti <marco.antoniotti@unimib.it> writes:

> 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

Ciao Mario,

not sure what maintainers think about it, I'm not in love with this
solution because one has to repeat 'foo' two times and we don't support
anyway unsing declare inside a function to declare another one.

Mmmhh

   Andrea



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-10  6:47     ` Andrea Corallo
@ 2024-05-10  9:50       ` Marco Antoniotti
  2024-05-10 10:21         ` Andrea Corallo
  0 siblings, 1 reply; 23+ messages in thread
From: Marco Antoniotti @ 2024-05-10  9:50 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: emacs-devel

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

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.

Cheers

MA

On Fri, May 10, 2024 at 8:47 AM Andrea Corallo <acorallo@gnu.org> wrote:

> Marco Antoniotti <marco.antoniotti@unimib.it> writes:
>
> > 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
>
> Ciao Mario,
>
> not sure what maintainers think about it, I'm not in love with this
> solution because one has to repeat 'foo' two times and we don't support
> anyway unsing declare inside a function to declare another one.
>
> Mmmhh
>
>    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: 2592 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-10  9:50       ` Marco Antoniotti
@ 2024-05-10 10:21         ` Andrea Corallo
  2024-05-10 11:53           ` Marco Antoniotti
                             ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Andrea Corallo @ 2024-05-10 10:21 UTC (permalink / raw)
  To: Marco Antoniotti; +Cc: emacs-devel, Eli Zaretskii, Stefan Monnier

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



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-10 10:21         ` Andrea Corallo
@ 2024-05-10 11:53           ` Marco Antoniotti
  2024-05-10 14:04           ` Stefan Monnier
  2024-05-11 10:29           ` Eli Zaretskii
  2 siblings, 0 replies; 23+ messages in thread
From: Marco Antoniotti @ 2024-05-10 11:53 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: emacs-devel, Eli Zaretskii, Stefan Monnier

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-10 10:21         ` Andrea Corallo
  2024-05-10 11:53           ` Marco Antoniotti
@ 2024-05-10 14:04           ` Stefan Monnier
  2024-05-10 14:17             ` Marco Antoniotti
  2024-05-11 10:29           ` Eli Zaretskii
  2 siblings, 1 reply; 23+ messages in thread
From: Stefan Monnier @ 2024-05-10 14:04 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: Marco Antoniotti, emacs-devel, Eli Zaretskii

>> The point is NOT to diverge from Common Lisp.  Such divergence is -
>> IMHO - unwarranted.

CL is a good inspiration in general, but ELisp is not and never will be
Common-Lisp, so it's not indispensable to adhere to its choices.
I think its provision of type annotation is not great, so there isn't
a strong need to follow it.

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

No objection here either.


        Stefan




^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-10 14:04           ` Stefan Monnier
@ 2024-05-10 14:17             ` Marco Antoniotti
  0 siblings, 0 replies; 23+ messages in thread
From: Marco Antoniotti @ 2024-05-10 14:17 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Andrea Corallo, emacs-devel, Eli Zaretskii

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

Hi Stefan

let me just add one (I swear!) more comment.

That CL is not perfect is a well known fact.  Case wars anybody?  Missing
pieces?  Shall I even mention (insert Kurtz's "The Horror" quote here) ...
pathnames?

But, since (function) type annotations are being added, not causing other
divergences is, IMHO, a Good Thing (tm).

All the best

MA


On Fri, May 10, 2024 at 4:04 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> >> The point is NOT to diverge from Common Lisp.  Such divergence is -
> >> IMHO - unwarranted.
>
> CL is a good inspiration in general, but ELisp is not and never will be
> Common-Lisp, so it's not indispensable to adhere to its choices.
> I think its provision of type annotation is not great, so there isn't
> a strong need to follow it.
>
> > 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.
>
> No objection here either.
>
>
>         Stefan
>
>

-- 
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: 2064 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-10 10:21         ` Andrea Corallo
  2024-05-10 11:53           ` Marco Antoniotti
  2024-05-10 14:04           ` Stefan Monnier
@ 2024-05-11 10:29           ` Eli Zaretskii
  2024-05-13 21:12             ` Andrea Corallo
  2 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2024-05-11 10:29 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: marco.antoniotti, emacs-devel, monnier

> From: Andrea Corallo <acorallo@gnu.org>
> Cc: emacs-devel@gnu.org, Eli Zaretskii <eliz@gnu.org>, Stefan Monnier
>  <monnier@iro.umontreal.ca>
> Date: Fri, 10 May 2024 06:21:21 -0400
> 
> 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?

Fine by me, thanks.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-11 10:29           ` Eli Zaretskii
@ 2024-05-13 21:12             ` Andrea Corallo
  2024-05-14  9:26               ` Andrea Corallo
  0 siblings, 1 reply; 23+ messages in thread
From: Andrea Corallo @ 2024-05-13 21:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: marco.antoniotti, emacs-devel, monnier

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Andrea Corallo <acorallo@gnu.org>
>> Cc: emacs-devel@gnu.org, Eli Zaretskii <eliz@gnu.org>, Stefan Monnier
>>  <monnier@iro.umontreal.ca>
>> Date: Fri, 10 May 2024 06:21:21 -0400
>> 
>> 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?
>
> Fine by me, thanks.

Ok, I'll try to take care of this tomorrow.

  Andrea



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-13 21:12             ` Andrea Corallo
@ 2024-05-14  9:26               ` Andrea Corallo
  2024-05-14 10:04                 ` Marco Antoniotti
  0 siblings, 1 reply; 23+ messages in thread
From: Andrea Corallo @ 2024-05-14  9:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: marco.antoniotti, emacs-devel, monnier

Andrea Corallo <acorallo@gnu.org> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Andrea Corallo <acorallo@gnu.org>
>>> Cc: emacs-devel@gnu.org, Eli Zaretskii <eliz@gnu.org>, Stefan Monnier
>>>  <monnier@iro.umontreal.ca>
>>> Date: Fri, 10 May 2024 06:21:21 -0400
>>> 
>>> 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?
>>
>> Fine by me, thanks.
>
> Ok, I'll try to take care of this tomorrow.

Gut, should be in with a39a8060124.

Thanks

  Andrea

PS Marco you'll receive a customer satisfaction survey shortly, please
give us a good score 😀.



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: (declare (type (function...
  2024-05-14  9:26               ` Andrea Corallo
@ 2024-05-14 10:04                 ` Marco Antoniotti
  0 siblings, 0 replies; 23+ messages in thread
From: Marco Antoniotti @ 2024-05-14 10:04 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: Eli Zaretskii, emacs-devel, Stefan Monnier

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

It will be good. :)

On Tue, May 14, 2024, 11:26 Andrea Corallo <acorallo@gnu.org> wrote:

> Andrea Corallo <acorallo@gnu.org> writes:
>
> > Eli Zaretskii <eliz@gnu.org> writes:
> >
> >>> From: Andrea Corallo <acorallo@gnu.org>
> >>> Cc: emacs-devel@gnu.org, Eli Zaretskii <eliz@gnu.org>, Stefan Monnier
> >>>  <monnier@iro.umontreal.ca>
> >>> Date: Fri, 10 May 2024 06:21:21 -0400
> >>>
> >>> 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?
> >>
> >> Fine by me, thanks.
> >
> > Ok, I'll try to take care of this tomorrow.
>
> Gut, should be in with a39a8060124.
>
> Thanks
>
>   Andrea
>
> PS Marco you'll receive a customer satisfaction survey shortly, please
> give us a good score 😀.
>

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2024-05-14 10:04 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.