a function @code{positive-p} that takes an argument of type @var{number}
and return a @var{boolean}:
-@group
@lisp
+@group
(defun positive-p (x)
(declare (type (function (number) boolean)))
(when (> x 0)
t))
-@end lisp
@end group
+@end lisp
Similarly this declares a function @code{cons-or-number} that: expects a
first argument being a @var{cons} or a @var{number}, a second optional
argument of type @var{string} and return one of the symbols
@code{is-cons} or @code{is-number}:
-@group
@lisp
+@group
(defun cons-or-number (x &optional err-msg)
(declare (type (function ((or cons number) &optional string)
(member is-cons is-number))))
(if (numberp x)
'is-number
(error (or err-msg "Unexpected input")))))
-@end lisp
@end group
+@end lisp
-More types are described in the Lisp Data Types chapter (@ref{Lisp Data
-Types}).
+For description of additional types, see @ref{Lisp Data Types}).
Declaring a function with an incorrect type produces undefined behavior
and could lead to unexpected results or might even crash Emacs when code
instead of this variable.
+++
-** Function type declaration
-It is now possible, using the 'declare' macro, to declare expected types
-of function arguments and return type.
+** Function type declaration.
+It is now possible to declare the expected type of a function's
+arguments and its return type using the 'declare' macro.
** New types 'closure' and 'interpreted-function'.
'interpreted-function' is the new type used for interpreted functions,