From: John Nagle on
On 8/1/2010 5:36 PM, Roy Smith wrote:
> In article<4c55fe82$0$9111$426a34cc(a)news.free.fr>,
> candide<candide(a)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.
>
> 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 for Python. Extensions have to be built with essentially the
same version of the same C compiler used for building Python. This
is a major headache.

John Nagle
From: Paul Rubin on
Grant Edwards <invalid(a)invalid.invalid> writes:
> There's no computing problem so simple that it can't be solved in a
> complex and obtuse manner in C++.
>
> I know that's true of any language, but from what I've seen over the
> years, it "more true" in C++.

http://www.willamette.edu/~fruehr/haskell/evolution.html
From: John Bokma on
Carl Banks <pavlovevidence(a)gmail.com> writes:

> On Aug 3, 2:29 am, John Bokma <j...(a)castleamber.com> wrote:

[..]

>> 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."

Yup, and if I read it correctly the claim was: and that's why C++ was
not chosen. I doubt it.

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

Yup, but still doesn't exclude C++ from being used to implement a
programming language.

And I would appreciate some respect, especially from someone who's too
lazy to do some editing before posting, thank you.

--
John Bokma j3b

Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development
From: John Bokma on
Ethan Furman <ethan(a)stoneleaf.us> writes:

> John Bokma wrote:
>> Michael Torrie <torriem(a)gmail.com> writes:
>>
>>> On 08/01/2010 07:09 PM, John Bokma wrote:
>>>>> 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, he is still right. Each C++ implementation did name mangling
>>> differently leading to "C" libraries that had incompatible names and
>>> signatures. Also each frontend could have generated incompatible
>>> vtables and other C++ structures. So C code generated by one C++
>>> frontend could not easily call C code generated by another C++ frontend.
>>> So the same arguments that are made about C++ now were just as valid
>>> back then when C++ was merely a fancy preprocessor.
>>
>> See my other post: I understand that two C++ preprocessors can't call
>> each others generated code, but if one uses C++ and knows that one can
>> only use shared C libraries on target systems, and not C++ libraries
>> that might be present (or more likely not: C++ was new in those days).
>
> So if Python were written in C++, and an extension was written in C++,
> how could the two call each other?

Via C.

--
John Bokma j3b

Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development
From: Carl Banks on
On Aug 3, 3:19 pm, John Bokma <j...(a)castleamber.com> wrote:
> Carl Banks <pavlovevide...(a)gmail.com> writes:
> > On Aug 3, 2:29 am, John Bokma <j...(a)castleamber.com> wrote:
>
> [..]
>
> >> 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."
>
> Yup, and if I read it correctly the claim was: and that's why C++ was
> not chosen. I doubt it.

I think it was. Not necessarily that GvR made a list of reasons to
choose C over C++. But the fact that C++ has almost no
interoperability between compilers except via regular C linkage is a
major cultural reason why it's avoided for programs that need
extensible APIs like Python, which is why language implementors try to
avoid it.

The availability of C++ fronts that translate to C isn't the slightest
bit relevant to this.


> > Hence, "It's much easier to distribute C libraries than C++
> > libraries."
>
> Yup, but still doesn't exclude C++ from being used to implement a
> programming language.

Well, if you want to write a language that people can write extensions
for using something other than the same C++ compiler you used, then
your only option is to use "C" external linkage which means that
whatever OOP advantages C++ gives you aren't going to be available to
extensions.

This is true even if you use a C++ front instead of a compiler.


Carl Banks