Why is python not written in C++ ?

Carl Banks pavlovevidence at gmail.com
Tue Aug 3 12:15:14 EDT 2010


On Aug 3, 2:29 am, John Bokma <j... at castleamber.com> wrote:
> Carl Banks <pavlovevide... at gmail.com> writes:
> > On Aug 1, 6:09 pm, John Bokma <j... at castleamber.com> wrote:
> >> Roy Smith <r... at panix.com> writes:
> >> > In article <4c55fe82$0$9111$426a3... at news.free.fr>,
> >> >  candide <cand... 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
> >> >> reasons?
>
> >> >> 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.
>
> >> In the beginning of C++ there were programs that just converted C++ to C
> >> (frontends). At least that is how the C++ compiler Acorn sold worked.
> >> So I don't think your argument was much true back then.
>
> > No, it was that way back then too.  They might all generate C code but
> > different C code by different backends wouldn't be able to call each
> > other natively.
>
> If you convert C++ to C, and compile the C code then that's not
> different from compiling the C code itself, correct?
>
>
> > For instnace the function
>
> > int foo(int);
>
> > might be name-mangled this way in one cfront:
>
> > foo$d
>
> > and this way in another:
>
> > ____int_foo__int_i
>
> But they call both the C libraries in the same way.

Go look at the original claim, the one that you responded to.  "It's
much easier to distribute C libraries than C++ libraries."

Of course they can both call C libraries.  All modern C++ compilers
can too, not just cfronts.  What almost no C++ compiler or C++ front
can do is call a C++ library that a different C++ compiler or C++
front generated.  (Unless they export function calls with C linkage,
but that's not too helpful since the ostensible benefit of C++ is
function overloading and subclassing and such, which you can't do at
all between different compilers or fronts.)

Hence, "It's much easier to distribute C libraries than C++
libraries."


[snip rest of post that misses the point]


Carl Banks



More information about the Python-list mailing list