Consider the following code
(defun somefunc (text) (message "hello, somefunc called with %s" text) ) (defun func-caller (func) (func "some string") ) (func-caller 'somefunc) This results in Lisp error: (void-function func) because inside func-caller the local symbol func has its variable component, not its function component, set to somefunc which is why we would have to write (funcall func "some string") instead.
Is there any way to tweak func-caller such that the parameter func is usable as a function rather than a variable in the body of func-caller?
I know I could do (funcall func ...) but the funcall is what I would like to avoid. Any trick to make the func behave like a function symbol, other than it being globally defined would be nice.
Why would I want this? No specific reason other than curiosity and to understand the inner workings of elisp better.
funcalland thatfuncallis exactly what I would like to avoid.