Re: why funcall is needed in things like ((foo) 10)



+ Rahul Jain <rjain@xxxxxxxx>:

| Just like the word "record" has different meaning when used as a
| verb vs. a noun, a lisp symbol or expression can have different
| meanings when used as an operator vs. a variable.

A symbol yes, but an expression? Variables have SYMBOL-VALUE and
SYMBOL-FUNCTION, but an expression like (foo bar) doesn't have that
distinction, so I don't see a /technical/ reason why

((foo bar) this that)

couldn't be syntactic sugar for

(funcall (foo bar) this that)

But perhaps nobody felt a need for it, and maybe they thought the
funcall version is clearer anyhow. Personally, I have no problem with
having to write the occasional FUNCALL, and it does point out very
clearly to the reader that something special is going on. (If I ever
see a FUNCALLs of the above sort in the code, I would begin to suspect
that the writer was unfamiliar with generic functions.)

--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
when there is no ground whatsoever for supposing it is true.
-- Bertrand Russell
.



Relevant Pages