unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrea Corallo <acorallo@gnu.org>
To: "Mattias Engdegård" <mattias.engdegard@gmail.com>
Cc: Andrea Corallo <akrl@sdf.org>,  Eli Zaretskii <eliz@gnu.org>,
	emacs-devel <emacs-devel@gnu.org>
Subject: Re: Inferred function types in the *Help* buffer
Date: Thu, 01 Jun 2023 15:13:38 -0400	[thread overview]
Message-ID: <yp14jnrgfml.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <A4098C27-6703-4BE8-B85A-C8B4A5C9D626@gmail.com> ("Mattias Engdegård"'s message of "Thu, 1 Jun 2023 19:53:07 +0200")

Mattias Engdegård <mattias.engdegard@gmail.com> writes:

> 1 juni 2023 kl. 17.10 skrev Andrea Corallo <acorallo@gnu.org>:
>
>> It's just a very concise and effective way to express the input/output
>> value/types of the function.  I, for one, find it very useful.
>
> If we want to be as nice as possible to the user then perhaps we should massage the output a bit.
> For instance, the `function` part is useless, and using the names of the arguments would be very helpful.
>
> In other words, instead of describing `make-string` as
>
>  (function (integer fixnum &optional t) string)
>
> we could say something like
>
>  LENGTH:integer INIT:fixnum MULTIBYTE -> string
>
> (Not sure how practical it is, I'm just making this up.)

I see your point, I'm not sure how practical this is tho.  'function' is
there to say that the type specifier in object is describing a function.

This is important because a function is just a special kind of object,
and for instance we might have a function returning a function, this way
we can express it with something like:

(function () (function () t))

Another advantage of this notation is that being it borrowed by CL is
already well formalized [1] and deployed.

My opinion is that we might want to extend this in order to be able to
express properties of the functions we want (ex the ones we now have in
byte-opt.el).

> How concise are inferred types, for that matter? I can imagine them becoming pretty voluminous.

They are quite concise, due to the dynamic nature of Lisp the native
compiler can't predict in many cases the return type accurately if at
all.  As mentioned in my emacs -Q ~22% of the loaded functions gets a
non t return type, indeed we might improve in the future.

> By the way, `expt` should have the return type `number`, not `float`. This is just something I noticed in passing; I haven't done any systematic review.

Thanks, the fix is now in the patch.

Best Regards

  Andrea

[1] <http://www.lispworks.com/documentation/lw70/CLHS/Body/04_bc.htm>



  reply	other threads:[~2023-06-01 19:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23 16:44 Inferred function types in the *Help* buffer Andrea Corallo
2023-05-24 10:46 ` Eli Zaretskii
2023-05-24 12:19   ` Andrea Corallo
2023-05-30 16:46     ` Andrea Corallo
2023-05-30 18:14       ` Mattias Engdegård
2023-05-30 18:48         ` Andrea Corallo
2023-05-31 12:19           ` Andrea Corallo
2023-05-31 14:08             ` Eli Zaretskii
2023-06-01 11:28             ` Mattias Engdegård
2023-06-01 11:35               ` Eli Zaretskii
2023-06-01 11:36                 ` Mattias Engdegård
2023-06-01 11:54                   ` Andrea Corallo
2023-06-01 11:50               ` Andrea Corallo
2023-06-01 13:06                 ` Mattias Engdegård
2023-06-01 13:34                   ` Andrea Corallo
2023-06-01 14:50                     ` Mattias Engdegård
2023-06-01 15:10                       ` Andrea Corallo
2023-06-01 17:53                         ` Mattias Engdegård
2023-06-01 19:13                           ` Andrea Corallo [this message]
2023-06-01 14:09                   ` Andrea Corallo
2023-05-31 13:46       ` Eli Zaretskii
2023-06-01  8:42         ` Andrea Corallo
2023-06-01  8:53           ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2023-05-23 16:47 Payas Relekar
2023-05-23 18:51 ` Philip Kaludercic
2023-05-24 12:20 ` Andrea Corallo

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=yp14jnrgfml.fsf@fencepost.gnu.org \
    --to=acorallo@gnu.org \
    --cc=akrl@sdf.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=mattias.engdegard@gmail.com \
    /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).