bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

functionp should be, in effect, funcallablep


From: Drew Adams
Subject: functionp should be, in effect, funcallablep
Date: Mon, 27 Aug 2007 08:57:30 -0700

`functionp' returns non-nil for special forms, as well as functions
that you can pass to `funcall' and `apply'. Prior to Emacs 22, it
apparently returned non-nil also for macros.

There is no simple predicate to test whether an object is a function
that is appropriate as the first argument for `funcall' and `apply'.
You can pass a function definition (e.g. `symbol-function' of a
symbol with non-empty function cell) to `subr-arity', and check for
`unevalled', but there is no predefined test that does the job.

Suggestion: Either (1) fix `functionp' so that it returns non-nil only
for functions that can be used by `funcall' and `apply', or (2) create
a new function (e.g. `funcallablep') that does this.

With (1), you could then do (if (functionp foo) (funcall foo)...).
With (2), you could do (if (funcallablep foo) (funcall foo)...).

In GNU Emacs 22.1.1 (i386-mingw-nt5.1.2600)
 of 2007-06-02 on RELEASE
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --cflags -Ic:/gnuwin32/include'






reply via email to

[Prev in Thread] Current Thread [Next in Thread]