From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.devel Subject: Re: Inferred function types in the *Help* buffer Date: Thu, 01 Jun 2023 15:13:38 -0400 Message-ID: References: <83o7manh0e.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22515"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Andrea Corallo , Eli Zaretskii , emacs-devel To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 01 21:14:25 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q4nke-0005cc-Cf for ged-emacs-devel@m.gmane-mx.org; Thu, 01 Jun 2023 21:14:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4njw-0000J8-3C; Thu, 01 Jun 2023 15:13:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q4njv-0000E9-3Z for emacs-devel@gnu.org; Thu, 01 Jun 2023 15:13:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q4nju-0002aX-An; Thu, 01 Jun 2023 15:13:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=76GFRVGLgugUZnYXiaILraL6t9qEpy8hhVV0pR9UGSk=; b=lG5I8aWC1OhULwzLji85 v6y73vU5VXbjqbREhCiT14Y3TFKsU/fwQ4d44pPkHPt6FM7DhiXTG9FUBRj8fynpM10Wgap7UG7AE +sqOgnWCM46xYQhA+jaY0+9p2TohE5yGz3ZWHNviFF6gVDa9C97MIGswdljvG0QUgQE7EwLrTnZzu CB8Ov1C1+4sJkpQ9+OrND4EaxTg2QRHfjzoxE4tYnEPsWjl1yAJxKdckDfJ0BKsslSpSh4M/y6s68 EYW65jfU+S5OwOPAPv9BdLV1WlQ24GyQmc4cV4y0TfpLw5vHfSkZJ0T2yrJZuRrjBK1pY9ag+zqhK Gm677as+jC/6wQ==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1q4nju-0006Bq-3A; Thu, 01 Jun 2023 15:13:38 -0400 In-Reply-To: ("Mattias =?utf-8?Q?Engdeg=C3=A5rd=22's?= message of "Thu, 1 Jun 2023 19:53:07 +0200") X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:306527 Archived-At: Mattias Engdeg=C3=A5rd writes: > 1 juni 2023 kl. 17.10 skrev Andrea Corallo : > >> 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 m= assage 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 becom= ing 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`. Thi= s is just something I noticed in passing; I haven't done any systematic rev= iew. Thanks, the fix is now in the patch. Best Regards Andrea [1]