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.bugs Subject: bug#73626: 30.0.91; Type specifiers of functions Date: Wed, 23 Oct 2024 18:29:06 -0400 Message-ID: References: <86msjkxdf5.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="7015"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 73626@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 24 00:30:04 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1t3jrg-0001dz-2U for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Oct 2024 00:30:04 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3jrD-0007mg-WF; Wed, 23 Oct 2024 18:29:36 -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 1t3jrB-0007m8-Jy for bug-gnu-emacs@gnu.org; Wed, 23 Oct 2024 18:29:33 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t3jrB-00071C-BG for bug-gnu-emacs@gnu.org; Wed, 23 Oct 2024 18:29:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=trmSfgQIX4P5xzp92ILJZTkuA7mUvK/MLIuYHgdqXw8=; b=XvBcvNFGSkMAPeFsNfB+0B1ch/YuMGdwVLes3qbaMOSDG5o+X24jEx1b3I1dV9WMbjb3+WHCSLwu9QTJtg7sNcPvcKZikJ8tZn84TW2ieN8Agh8wIUs5/8fJYUway+xu+0SNl98HjXND3dJNKWAzxF91Yt6/j94LKs2xb4Q2nO99VM8Boua3MGrq4mX+CiQFbOsuJj/vDcptwgs1ENwYjVFw3DKsOIL2vQ/PNIawOeObqsoJXCBxZXfMoTHvqevwZsWQM6kUJMh9z+nDUz523dfTd2FCb6Ebi8Wqba42BawaZUWtmok0cUgd/N1b0+tEMRcbpErweVJAhDNuVucQcw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t3jre-0003s8-RM for bug-gnu-emacs@gnu.org; Wed, 23 Oct 2024 18:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Oct 2024 22:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73626 X-GNU-PR-Package: emacs Original-Received: via spool by 73626-submit@debbugs.gnu.org id=B73626.172972258714835 (code B ref 73626); Wed, 23 Oct 2024 22:30:02 +0000 Original-Received: (at 73626) by debbugs.gnu.org; 23 Oct 2024 22:29:47 +0000 Original-Received: from localhost ([127.0.0.1]:32809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t3jrO-0003rC-QA for submit@debbugs.gnu.org; Wed, 23 Oct 2024 18:29:47 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56900) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t3jrL-0003qu-Tn for 73626@debbugs.gnu.org; Wed, 23 Oct 2024 18:29:45 -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 1t3jqm-0006zP-QI for 73626@debbugs.gnu.org; Wed, 23 Oct 2024 18:29:08 -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=trmSfgQIX4P5xzp92ILJZTkuA7mUvK/MLIuYHgdqXw8=; b=AUPpPchq+j9H/+tNbi4W v8Dx+jisakf/dj8vaeYSYz2/oTrZ7srp3pO8+MPtgsP/YeqvCBrqGW3ZLugJc5yCYWXu0dQTqtiSi CGAGH5DUq5bHIsWWMAUapg0UNKKC2fIkxDDItnBHhZcZQdig4XhCFPhbxIdyRtkwKTZjoWgNknuo6 +weR1nFwJ59G7JGARVy9eo2VwKhzDAJ7HYmsdmmCLkS6o8BxoU2FWIkoRIE55sclWW8Z5tsnTN5VQ JTygS8uyUUgc7AcPNHJGrhu09p2QfwA4/RmrkrwckRJKiqDOpGi1DFqLLoSuXIJe7vtODh2U3Apcz VKJrTGWt/l8/HQ==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1t3jqk-0002ia-AC; Wed, 23 Oct 2024 18:29:07 -0400 In-Reply-To: <86msjkxdf5.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 04 Oct 2024 15:25:50 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:294159 Archived-At: Hi Eli, sorry for being late on this. Eli Zaretskii writes: > To reproduce: > > emacs -Q > C-h f sort-lines RET > > (That particular function is just an example, basically, any function > should do.) > > Observe in the *Help* buffer: > > sort-lines is an autoloaded interactive byte-code-function in > =E2=80=98sort.el=E2=80=99. > > (sort-lines REVERSE BEG END) > > If sort.el was native-compiled, you will see this instead: > > sort-lines is an autoloaded interactive native-comp-function in > =E2=80=98sort.el=E2=80=99. > > (sort-lines REVERSE BEG END) > > So far so good, but in a long-running Emacs session I see this: > > sort-lines is an autoloaded interactive native-comp-function in > =E2=80=98sort.el=E2=80=99. > > (sort-lines REVERSE BEG END) > > Inferred type: (function (t t t) t) <<<<<<<<<<<<<<<<<<<<<< > > and sometimes this: > > bobp is a primitive-function in =E2=80=98src/editfns.c=E2=80=99. > > (bobp) > > Declared type: (function nil boolean) <<<<<<<<<<<<<<<<<<<<< > > These Declared/Inferred type thingies are not documented anywhere, > AFAICT. If one looks really hard, one can find in "Declare Form" the > description of "(ftype TYPE &optional FUNCTION)", but still nothing > about declared/inferred. I see in help-fns.el:help-fns--signature > that we call comp-function-type-spec to get this information, and the > doc string of comp-function-type-spec says: > > Return the type specifier of FUNCTION. > > But there are no matches for "type specifier" anywhere in the ELisp > manual, and comp-function-type-spec itself is not documented there. > > Even after looking and finding all those pieces of the puzzle, the > overall picture is not clear. The following is missing, and should be > documented in the ELisp manual: > > . what is the importance of inferred vs declared type The user get to know that the function type was computed by the compiler or manually declared by the user. > . how to read the type specifiers, The format is the same described for type declarations ((elisp)Top > Functions > Declare Form). I agree we should probably better document this somewhere else, probably in Lisp Data Types? > and in particular what do those "t" members mean, t is a type documented (elisp)Top > Lisp Data Types > Type Hierarchy > and more generally, which forms can appear in the > car of the cons cell returned by comp-function-type-spec Hope I answered before. > . why "C-h f" shows this information only for some functions and not > for others, and what is the significance of that C-h f does not show the inferred type if the functions has still to be native compiled and loaded, the reason is simply that is the native compiler computing the type. > Bottom line: we decided that this information is important enough to > show it in the *Help* buffer, so we should explain its arcane parts to > make them useful. Agree. Is '(elisp)Top > Lisp Data Types' a reasonable place for that? Otherwise where should we do it? Thanks Andrea