Python syntax in Lisp and Scheme

Alex Martelli aleax at aleax.it
Fri Oct 10 09:24:06 EDT 2003


Björn Lindberg wrote:
   ...
>> Agreed.  I pointed out elsewhere that there has been no systematic
>> study to show that Lisp code is indeed "so much shorter than the
>> equivalent code in other languages" where "other languages" include
>> Python, Perl, or Ruby.
> 
> It would be interesting to see such studies made.

Absolutely!  But funding such studies would seem hard.  Unless some
company or group of volunteers had their own reasons to take some
existing large app coded in Lisp/Python/Perl/Ruby, and recode it in
one of the other languages with essentially unchanged functionality,
which doesn't seem all that likely.  And if it happened, whatever
group felt disappointed in the results would easily find a zillion
methodological flaws to prove that the results they dislike should
be ignored, nay, reversed.

In practice, such a re-coding would likely involve significant
changes in functionality, making direct comparisons iffy, I fear.

I know (mostly by hearsay) of some C++/Java conversions done
within companies (C++ -> Java for portability, Java -> C++ for
performance) with strong constraints on functionality being "just
the same" between the two versions (and while that's far from
a "scientific result", a curious pattern seems to emerge: going
from C++ to Java seems to produce the same LOC's, apparently a
disappointment for some; going from Java to C++ seems to expand
LOC's by 10%/20%, ditto -- but how's one to say if the C++ code
had properly exploited the full macro-like power of templates,
for example...?).  But I don't even have hearsay about any such
efforts between different higher-level languages (nothing beyond
e.g. a paltry few thousand lines of Perl being recoded to Python
and resulting in basically the same LOC's; or PHP->Python similarly,
if PHP can count as such a language, perhaps in a restricted context).


>> In any case, it implies you need to get to some serious sized
>> programs (1000 LOC? 10000LOC? A million?) before
>> the advantages of Lisp appear to be significant.
> 
> I think that goes for any advantages due to abstraction capabilities
> of macros, OO or HOF. The small program in the study above seems to
> capture the scripting languages higher level compared to the
> close-to-the-machine languages C & C++. (I have not read all of it
> though.) To show advantages of the abstraction facilities we have been
> discussing in this thread, I believe much larger programs are needed.

Yes, and perhaps to show advantages of one such abstraction facility
(say macros) wrt another (say HOFs) would require yet another jump up
in application size, if it could be done at all.  Unless some great
benefactors with a few megabucks to wast^H^H^H^H invest for the general
benefit of humanity really feel like spending them in funding such
studies, I strongly suspect they're never really going to happen:-(.


Alex





More information about the Python-list mailing list