]> git.eshelyaron.com Git - emacs.git/commitdiff
* doc/lispref/functions.texi (Declare Form): Rename and update 'ftype' entry.
authorAndrea Corallo <acorallo@gnu.org>
Tue, 14 May 2024 08:50:05 +0000 (10:50 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 16 May 2024 08:21:24 +0000 (10:21 +0200)
(cherry picked from commit a39a8060124a5c9390cab186dece82ea35164f70)

doc/lispref/functions.texi

index deca99960c75a5da8572824c70f2a60a1d4324d7..dcce4043064f8d4fed9a84e45f1a2f31a9977049 100644 (file)
@@ -2715,7 +2715,7 @@ function.  This allows function-level control of the safety level used
 for the code emitted for the function (@pxref{Native-Compilation
 Variables}).
 
-@item (type @var{type})
+@item (ftype @var{type} &optional @var{function})
 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
 native compiler (@pxref{Native Compilation}) for improving code
@@ -2727,14 +2727,16 @@ without type declaration.
 interleaved with symbols @code{&optional} and @code{&rest} to match the
 function's arguments (@pxref{Argument List}).
 
-Here's an example of using @code{type} inside @code{declare} to declare
+@var{function} if present should be the name of function being defined.
+
+Here's an example of using @code{ftype} inside @code{declare} to declare
 a function @code{positive-p} that takes an argument of type @var{number}
 and return a @var{boolean}:
 
 @lisp
 @group
 (defun positive-p (x)
-  (declare (type (function (number) boolean)))
+  (declare (ftype (function (number) boolean)))
   (when (> x 0)
     t))
 @end group
@@ -2748,8 +2750,8 @@ argument of type @var{string} and return one of the symbols
 @lisp
 @group
 (defun cons-or-number (x &optional err-msg)
-  (declare (type (function ((or cons number) &optional string)
-                          (member is-cons is-number))))
+  (declare (ftype (function ((or cons number) &optional string)
+                           (member is-cons is-number))))
   (if (consp x)
       'is-cons
     (if (numberp x)