; Improve documentation of "function types"

* doc/lispref/functions.texi (Declare Form):
* doc/lispref/objects.texi (Type Specifiers): Improve wording and
indexing.
This commit is contained in:
Eli Zaretskii 2025-03-25 14:37:17 +02:00
parent 0c32f7521b
commit 6a3e2b88d2
2 changed files with 7 additions and 4 deletions

View file

@ -2727,12 +2727,15 @@ for the code emitted for the function (@pxref{Native-Compilation
Variables}). Variables}).
@cindex function type declaration @cindex function type declaration
@cindex inferred type of function
@item (ftype @var{type} &optional @var{function}) @item (ftype @var{type} &optional @var{function})
Declare @var{type} to be the type of this function. This is used for Declare @var{type} to be the type of this function. This is used for
documentation by @code{describe-function}. Also it can be used by the documentation by @code{describe-function}. Also it can be used by the
native compiler (@pxref{Native Compilation}) for improving code native compiler (@pxref{Native Compilation}) for improving code
generation and for deriving more precisely the type of other functions generation and for deriving more precisely the type of other functions
without type declaration. without type declaration. Functions that have such type declarations
will be shown by @kbd{C-h C-f} as having a @dfn{declared type} (as
opposed to @dfn{inferred type} of functions without declaration).
@var{type} is a @dfn{type specifier} (@pxref{Type Specifiers}) in the @var{type} is a @dfn{type specifier} (@pxref{Type Specifiers}) in the
form @w{@code{(function (@var{arg-1-type} @dots{} @var{arg-n-type}) form @w{@code{(function (@var{arg-1-type} @dots{} @var{arg-n-type})

View file

@ -1552,9 +1552,9 @@ types and the return type of a function. Argument types can be interleaved
with symbols @code{&optional} and @code{&rest} to match the function's with symbols @code{&optional} and @code{&rest} to match the function's
arguments (@pxref{Argument List}). arguments (@pxref{Argument List}).
The type specifier represent a function whose first parameter is of type The following type specifier represents a function whose first parameter
@code{symbol}, the second optional parameter is of type @code{float}, is of type @code{symbol}, the second optional parameter is of type
and which returns an @code{integer}: @code{float}, and which returns an @code{integer}:
@example @example
(function (symbol &optional float) integer) (function (symbol &optional float) integer)