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

Re: Macros and anonymous functions



Bruce Lewis wrote:
> 
> Paul Prescod <paul@prescod.net> writes:
> 
> > Python has anonymous functions.
> 
> That's a good thing.  I got the impression you were inclined to remove
> them from the language in favor of requiring that all functions be
> named.  If you are not so inclined, no argument from me.

I go back and forth on the issue but I still maintain that their removal
would not hurt the ability to add macros to the language. After all, you
would be removing the *syntax* for anonymous functions but the
underlying semantic capabilities would still be there because Python
allows nested functions with closures. When you added the macro facility
it would under the covers use the anonymous function feature. For
instance:

#my-macro(plot, x*2+3)

Python could pass the latter expression to the macro as an anonymous
function even though the user never typed "lambda".

 Paul Prescod