Why don't people like lisp?

Jock Cooper jockc at mail.com
Thu Oct 23 18:26:20 CEST 2003


Matthew Danish <mdanish at andrew.cmu.edu> writes:

> On Wed, Oct 22, 2003 at 09:52:42AM -0700, Jock Cooper wrote:
> > One of the important differences is that MY-FUNC is lexically isolated
> > from the environment where WITH-OPEN-FILE appears.  The macro version
> > does not suffer this; and it is often convenient for the code block
> > in the WITH-OPEN-FILE to access that environment.
> 
> (call-with-open-file
>   #'(lambda (stream)
>       ...)
>   "somefile"
>   :direction :input)
> 
> WITH-OPEN-FILE happens to be one of those macros which doesn't require
> compile-time computation, but rather provides a convenient interface to
> the same functionality as above.
> 
> -- 

Right, if the function is specified as a lambda inside the call then it
*would* have access to the surrounding lexical space.

The recent thread on macros has got me thinking more carefully about
when I use macros, and if I could use functions instead.





More information about the Python-list mailing list