Why is python not written in C++ ?
Albert van der Horst
albert at spenarnc.xs4all.nl
Sat Aug 7 16:48:29 CEST 2010
In article <roy-30C94B.20362001082010 at news.panix.com>,
Roy Smith <roy at panix.com> wrote:
>In article <4c55fe82$0$9111$426a34cc at news.free.fr>,
> candide <candide at free.invalid> wrote:
>> Python is an object oriented langage (OOL). The Python main
>> implementation is written in pure and "old" C90. Is it for historical
>> C is not an OOL and C++ strongly is. I wonder if it wouldn't be more
>> suitable to implement an OOL with another one.
>One thing that comes to mind is that it's much easier to distribute C
>libraries than C++ libraries.
>If I compile a main program with one C compiler and you compile a
>dynamically loaded library with another C compiler on the same box, the
>odds are pretty good they'll interoperate without any problems.
>Not at all so with C++ compilers. The linkage is *way* more
>complicated. Not just how the two compilers do name mangling, but how
>they handle exceptions, RVO, and a zillion other details. Pretty much
>the only way to make it work is to compile everything with exactly the
>same compiler. That would make it pretty close to impossible for people
>to take a Python core distribution and add their own extension modules
We had a similar discussion on comp.lang.forth.
The bottom line is that to implement a programming language
you want to use a simpler programming language, not a more
complicated one. Then there is a secondary requirement,
that language must allow sufficient access to low level features
to allow decent performance.
A third aspect is that Linux/Unices as well as Windows assume
OS interaction in terms of c-libraries. Any intermediary is
inconvenient at least.
Or in one catch phrase:
" To implement a programming language you need a high level
assembler like C."
(We went on whether Forth would be a suitable high level assembler
for Haskell. It would beat C++ -- not C -- for implementing Python,
that much I'm sure.)
Undoubtedly C is the right choice to implement Python.
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert at spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
More information about the Python-list