[pro] Lisp 2's and function values.
Matthew Swank
akopa.gmane.poster at gmail.com
Wed May 25 14:45:39 UTC 2011
Pascal Costanza <pc at ...> writes:
>
>
> On 25 May 2011, at 04:51, Matthew D. Swank wrote:
> > 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...
>
Yes you'd have to watch for symbols. The idiom would be to coerce values for use
in the car:
((callable (returns-a-function?)) arg arg ...)
or stick to using funcall.
Matt
More information about the pro
mailing list