Why don't people like lisp?

Peter Seibel peter at javamonkey.com
Fri Oct 24 14:35:14 EDT 2003


"Rainer Deyke" <rainerd at eldwood.com> writes:

> Jon S. Anthony wrote:
> > "Rainer Deyke" <rainerd at eldwood.com> writes:
> >
> >> I'm all for more elaborate gc schemes.  In particular, I want one
> >> that gives me guaranteed immediate destructors even in the presence
> >> of reference cycles.  And I want to language specification to
> >> guarantee it.
> >
> > It's difficult to even put a requirement for "gc" in a language
> > _specification_ let alone one that _guarantees_ this sort of thing.
> >
> >
> >> Having to explicitly close files is something I'd expect in C or
> >> assembly, but it has no place in high-level languages.  And
> >> "with-open-file" is too limiting.  Let the computer do the work, not
> >> the programmer.
> >
> > What's limiting about it?
> 
> Unless I've completely misunderstood the concept, "with-open-file"
> requires me to structure my program such that the file is opened at
> the beginning and closed at the end of a block of code.

I don't know about "completely" but you've certainly misunderstood an
important point. Yes, WITH-OPEN-FILE attempts to open a file, executes
a block of code with the open stream bound to a variable, and then
closes the stream when the block is exited, even if something goes
wrong such as a condition being signaled.

But--and this is the bit I think you may have missed--if that's *not*
what you want you don't use WITH-OPEN-FILE. Lisp also provides OPEN
and CLOSE, that act as you'd expect and allow you to explicitly
control the lifetime of the file stream.

Which gets us back to Pascal's original point--WITH-OPEN-FILE is a
macro that abstracts a set of operations in a concise way. (In
addition to ensuring that the file is closed, it also allows us to
easily express what to do in certain situations while trying to open
the file--what to do if the file already exists or doesn't exist,
etc.)

-Peter

-- 
Peter Seibel                                      peter at javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp




More information about the Python-list mailing list