Python's biggest compromises

Paul Rubin http
Fri Aug 1 10:23:55 EDT 2003


Michael Hudson <mwh at python.net> writes:
> > One shouldn't argue by tradition alone, but the fact that the major
> > implementations of dynamic languages like LISP and Smalltalk don't
> > use reference counting should carry some weight.
> 
> True.  But the major implementations of these languages are also
> usually less portable, and something more of a fiddle to write C
> extensions for (at least, for the implementations I know about, which
> are mostly CL impls).

I'd say the opposite, the Lisp implementations I've worked on are
considerably easier to write C extensions for, partly BECAUSE you
don't have to worry about constantly tweaking ref counts.  In GNU
Emacs Lisp, for example, if you cons a new heap object and put it in a
C variable and (iirc) then call eval, you have to call a macro that
tells the GC not to sweep the object.  But many C functions don't make
new objects, and most don't call eval, and you don't have to remember
what objects you've called the macro for.  There's another macro that
you call before your function returns, and that cleans up all the GC
records in your stack frame made by any invocations of the first macro.




More information about the Python-list mailing list