[pro] Lisp 2's and function values.

Pascal Costanza pc at p-cos.net
Wed May 25 05:34:22 UTC 2011


On 25 May 2011, at 04:51, Matthew D. Swank wrote:

> I have implemented a small fexpr interpreter in Common Lisp based on
> Kernel http://web.cs.wpi.edu/~jshutt/kernel.html. Right now it's a Lisp
> 1, but I am considering trying to make it a more idiomatic extension of
> Common Lisp by making it a Lisp 2.
> 
> Part of the Lisp 2-ness of the Common Lisp evaluator is that the car of
> a form must name a function, macro, or special form. This name is either
> a symbol bound in the function name space, or a lambda expression.
> However, Kernel just requires the car evaluate to a combiner (this is
> what Kernel calls a generic operator). Obviously, in a Lisp 2, a symbol
> would evaluate to the value bound to it in the function name space. 
> However, consider the following:
> 
> ((returns-a-function) arg arg ...)
> 
> Would it be reasonable to allow this as a legal form as well?
> 
> I'm not arguing Common Lisp should work this way, but I seems to make
> sense in the context of a Kernel like evaluator.

_If_ (returns-a-function) indeed returns a function, then this could be ok. But what if it doesn't return a function? What if it is a macro that returns just a symbol? Do you want to risk that ((return-something) ...) has a different meaning than (funcall (return-something) ...)? This is potentially confusing and could lead to code that is hard to debug...

Pascal

--
Pascal Costanza
The views expressed in this email are my own, and not those of my employer.







More information about the pro mailing list