OO misconceptions

François Pinard pinard at iro.umontreal.ca
Fri Jul 20 02:47:22 CEST 2001

[Marcin 'Qrczak' Kowalczyk]

> 17 Jul 2001 17:50:16 -0400, François Pinard <pinard at iro.umontreal.ca> pisze:

> > I'm still dreaming about an automatic Perl to Python converter.
> > Despite many consider this is not possible, I stick with my naive
> > impression we could do something about it.

> How would you translate
>     eval $x;
> ?

I do not know.  I guess that if `eval' is used in Perl code, the translator
would have to be invoked at run time.

About `eval', I try to avoid it in Perl as well in Python.  Much less in
traditional LISP should I say, where `eval' is pretty fundamental.  I much
try to avoid it in Scheme, as it is not part of the strict definition of
the language.  But it is true that `eval' is nevertheless easily used and
abused in most languages where it is available.

Do people remember Pascal to C translators?  The Swedish one was doing a
rather perfect job, but it was very stiff on the conformance of the input,
and was producing poor style code, so requiring from the user a very serious
editing and tidying session to make the code maintainable.  The translator
written by David Gillespie was producing much more maintainable code out of
the box, was able to read a few variants of Pascal, but the code was more
approximative and called for manual revision on various fingered spots,
to make sure the programmer's intent has been preserved.  Of course, the
notorious CWeb had to do perfectly working _and_ readable translations,
but required carefully crafted configuration files for each conversion job.

I presume that the second approach would be a good one on the average.
-------------- next part --------------

François Pinard   http://www.iro.umontreal.ca/~pinard

More information about the Python-list mailing list