Why don't people like lisp?

Bjorn Pettersen bjorn.pettersen at comcast.net
Fri Oct 24 05:11:18 EDT 2003


Raymond Wiker <Raymond.Wiker at fast.no> wrote in
news:864qxz2if5.fsf at raw.grenland.fast.no: 

> "Rainer Deyke" <rainerd at eldwood.com> writes:
> 
>> Jon S. Anthony wrote:
>>> Brian Kelley <bkelley at wi.mit.edu> writes:
>>>> Now the usage is:
>>>>
>>>> f = SafeFileWrapper(open(...))
>>>> print >> f, "A couple of lines"
>>>> f.close()
>>> ...
>>>> I still have to explicitly close the file though when I am done
>>>> with 
>>>
>>> It's just this sort of monotonous (yet important) book keeping
>>> (along with all the exception protection, etc.) that something like
>>> with-open-file ensures for you.
>>
>> Personally I'd prefer guaranteed immediate destructors over
>> with-open-file. More flexibility, less syntax, and it matches what
>> the CPython implementation already does.
> 
>         Right... all along until CPython introduces a more elaborate
> gc scheme. 

... which is highly unlikely to happen without preservation of reference 
counting semantics for files... google if you're _really_ interested :-/

>         Note that reference-counting has problems with cyclic
> references; probably not something that will bite you in the case of
> open files, but definitely a problem you need to be aware of.

(a) true (by definition of cycle/ref.counting?)
(b) no relevance to CPython (which uses a generational collector
    to reclaim reference cycles [with the regular finalizer problems]).
(c) why are open file objects special (are you saying objects with no
    internal references are less likely to be reachable from a cycle,
    or that there is something intrinsically special about (open?) files)?

-- bjorn




More information about the Python-list mailing list