Why is python not written in C++ ?

G

Grant Edwards

Well, there?s GNAT, the GNU Ada implementation. Seems pretty robust and
complete, while offering backward compatibility with some of those ?initial
implementations?, presumably because people have so much code already
written for them.

Yep, I've installed Gnat a couple times with the intention of playing
around with it, but there's pretty much zero chance I could sell it at
the office in place of C/C++ for embedded stuff, and for desktop stuff
it's just way to easy to get programs done using Python.

I also looked at Modula-3 once, and thought it had some real promise,
but I think it's probably deader than Ada now.
 
P

Paul Rubin

Grant Edwards said:
Yep, I've installed Gnat a couple times with the intention of playing
around with it, but there's pretty much zero chance I could sell it at
the office in place of C/C++ for embedded stuff,

I wonder what the issues are. From everything I've heard, it's a pretty
good compiler. It does ok against C/C++ in the Alioth shootouts. I
haven't written anything in it beyond "hello world" but I've looked at
the wikibook about it and that intro piece that I linked earlier. It's
more verbose than C, so coding in it takes more keystrokes, but it looks
to me like the general coding approach (modulo the extra keystrokes)
should be similar to that of C, Algol, and so on, and the results should
be quite a bit more reliable.

Mozilla is fed up with C++ and seems to be working on its own language,
called Rust:

http://lambda-the-ultimate.org/node/4009
 
G

Grant Edwards

I wonder what the issues are.

The issue that would prevent its use where I work is the inability to
hire anybody who knows Ada. You can't hire anybody who knows C++
either, but you can hire lots of people who claim they do. [I'm not
convinced that there are more than about 6 people on the planet who
know C++ well enough that they should be writing real projects in it.]

That said, the last time I looked the Ada spec was only something like
100 pages long, so a case could be made that it won't take long to
learn. I don't know how long the C++ language spec is, but I'm
betting it's closer to 1000 than 100. But I failed when I tried to
get people to use Python, so I doubt I'd have any better luck with
Ada.
From everything I've heard, it's a pretty good compiler.

I think it's probably a very good compiler. It's the compiler users
that are the issue.
It does ok against C/C++ in the Alioth shootouts. I haven't written
anything in it beyond "hello world" but I've looked at the wikibook
about it and that intro piece that I linked earlier. It's more
verbose than C,

The verbosity always bugged me a little. To my eyes all the sugar
gets in the way of seeing the code. Somebody should invent a language
where indentation defines the blocks.
so coding in it takes more keystrokes, but it looks to me like the
general coding approach (modulo the extra keystrokes) should be
similar to that of C, Algol, and so on, and the results should be
quite a bit more reliable.
Indeed.

Mozilla is fed up with C++ and seems to be working on its own language,
called Rust:

http://lambda-the-ultimate.org/node/4009

Great! The world needs one more computer language...
 
P

Paul Rubin

Grant Edwards said:
The issue that would prevent its use where I work is the inability to
hire anybody who knows Ada. ...
That said, the last time I looked the Ada spec was only something like
100 pages long, so a case could be made that it won't take long to
learn.

Well, I don't know Ada (I've read about it but not written actual code),
so maybe I shouldn't be the one saying this, but geez, it's another
imperative, procedural language, like Algol or Pascal or even C. Its
type is much more serious than C's but shouldn't be a problem for anyone
who uses C++ or Java generics. It also has a real module system unlike
more commonly used languages, but 1) that part seems easy to understand;
and 2) usually that's used for multi-programmer projects, so as long as
there's some reasonable proportion of experienced users on the team, the
inter-module interfaces should be sensible and less experienced users
can just program to existing interfaces and/or get some help from
others. Ada's module system is much simpler than (say) ML's.
I don't know how long the C++ language spec is, but I'm
betting it's closer to 1000 than 100.

I don't know about an official spec. Stroustrup's "The C++ programming
language" is about 1000 pp, but it's a textbook, with lots of examples,
exercises, etc. I read through an earlier (shorter) edition in a couple
of evenings a long time ago and it all made sense. It has some hairy
aspects like the notorious template metaprogramming, but most users
simply won't get involved with that. Python has its own obscure and
confusing features if that matters. I think I'm a reasonably good
Python programmer but I've never written a special metaclass and
wouldn't really know how to.
 
S

sturlamolden

The issue that would prevent its use where I work is the inability to
hire anybody who knows Ada.  You can't hire anybody who knows C++
either, but you can hire lots of people who claim they do.  

That is very true.
 
C

Carl Banks

Mozilla is fed up with C++ and seems to be working on its own language,
called Rust:

   http://lambda-the-ultimate.org/node/4009

That looks much better than Go.

It's like all the cool features of Go without the annoying polemics.
I'm starting to get the feeling one of these languages is going to hit
a sweet spot and turn C into the next Cobol.


Carl Banks
 
R

Roy Smith

sturlamolden said:
That is very true.

I suspect there are less than 100 people in the world who "know C++" in
the sense that they know every feature, every detail, every quirk.
These are the people who sit on the standards committee, write the books
we all buy, etc.

There are, however, a lot of people who know a large enough subset of
C++ to be productive and to write effective, safe, quality code within
those boundaries. These people know what they don't know and either
avoid using those features, or know where (and when) to look it up. I
put myself in that camp.

The problem is, there are also a very large number of people who put
"expert C++" on their resumes and know just enough to be dangerous.

The real problem is that it's sometimes difficult to distinguish between
the members of the latter two groups in an interview.
 
L

Lawrence D'Oliveiro

It's more verbose than C, so coding in it takes more keystrokes, but it
looks to me like the general coding approach (modulo the extra keystrokes)
should be similar to that of C, Algol, and so on, and the results should
be quite a bit more reliable.

I believe the life-support software on the International Space Station is
written in Ada. Would anybody feel happier if that had been done in C++?
 
L

Lawrence D'Oliveiro

That said, the last time I looked the Ada spec was only something like
100 pages long, so a case could be made that it won't take long to
learn. I don't know how long the C++ language spec is, but I'm
betting it's closer to 1000 than 100.

I have a copy of “The C++ Standard (Incorporating Technical Corrigendum No.
1)†on my bookshelf. Let’s see ... flip-flip ... the highest page number is
782. Definitely closer to 1000 than 100.

As for Ada ... I don’t have any printed manual, but

dpkg-query -L ada-reference-manual | grep -c html/aarm95tc1

counts 353 HTML pages for the annotated reference.

I found it fairly tedious to read the lot. But then, I didn’t even try to do
that with the C++ spec...
 
L

Lawrence D'Oliveiro

There are, however, a lot of people who know a large enough subset of
C++ to be productive ...

I think there are some language features, knowledge of which has a negative
impact on productivity. :)
 
P

Paul Rubin

Lawrence D'Oliveiro said:
I believe the life-support software on the International Space Station is
written in Ada. Would anybody feel happier if that had been done in C++?

Take a look at the articles on C bug-finding on Dawson Engler's page:

http://www.stanford.edu/~engler/

They are about tools that found 100's of bugs in various large C
programs including Linux and OpenBSD. Most of those bugs would probably
not have been possible in Ada. Program bugs are generally either subtle
errors or dumb ones. Humans always will make dumb errors from time to
time, and C does almost nothing to prevent them (C++ used properly is
somewhat better). Ada doesn't prevent the subtle ones but appears much
better than C or C++ at preventing the dumb kind.

I'm not sure what the hiring issue is. I think anyone skilled in C++ or
Java can pick up Ada pretty easily. It's mostly a subset of C++ with
different surface syntax.
 
N

Neil Hodgson

Grant Edwards:
That said, the last time I looked the Ada spec was only something like
100 pages long, so a case could be made that it won't take long to
learn. I don't know how long the C++ language spec is, but I'm
betting it's closer to 1000 than 100.

The Ada 2012 Language Reference Manual is 860 pages and the Ada 2005
LRM was 790 pages. The annotated versions are even longer
http://www.ada-auth.org/standards/ada12.html

Neil
 
L

Lawrence D'Oliveiro

Neil said:
The Ada 2012 Language Reference Manual is 860 pages and the Ada 2005
LRM was 790 pages. The annotated versions are even longer
http://www.ada-auth.org/standards/ada12.html

Yeah, unfortunately the language was designed by a committee which was
trying to meet a specification laid down by another committee set up by the
US military.

It seems apt to describe the resulting design as “bulletproofâ€, but
“elegant†or “concise†... not so much.
 
L

Lawrence D'Oliveiro

In message
This is unsafe, anyone who writes this in C++ should be flogged:

Only if they’re using exceptions. Otherwise, it’s fine.
 
J

Jean-Michel Pichavant

Carl said:
That looks much better than Go.

It's like all the cool features of Go without the annoying polemics.
I'm starting to get the feeling one of these languages is going to hit
a sweet spot and turn C into the next Cobol.


Carl Banks
I hope you're right, for our children sanity :)

JM
 
G

Grant Edwards

Well, I don't know Ada (I've read about it but not written actual
code), so maybe I shouldn't be the one saying this, but geez, it's
another imperative, procedural language, like Algol or Pascal or even
C. Its type is much more serious than C's but shouldn't be a problem
for anyone who uses C++ or Java generics.

I agree 100%.
It also has a real module system unlike more commonly used languages,
but 1) that part seems easy to understand; and 2) usually that's used
for multi-programmer projects, so as long as there's some reasonable
proportion of experienced users on the team, the inter-module
interfaces should be sensible and less experienced users can just
program to existing interfaces and/or get some help from others.
Ada's module system is much simpler than (say) ML's.


I don't know about an official spec. Stroustrup's "The C++
programming language" is about 1000 pp, but it's a textbook, with
lots of examples, exercises, etc. I read through an earlier
(shorter) edition in a couple of evenings a long time ago and it all
made sense. It has some hairy aspects like the notorious template
metaprogramming, but most users simply won't get involved with that.
Python has its own obscure and confusing features if that matters.

I couldn't get anybody to use Python either. :/

The problem has nothing to do with the relative merits of the
languages. The problem is inertia.
 
G

Grant Edwards

I'm not sure what the hiring issue is. I think anyone skilled in C++
or Java can pick up Ada pretty easily. It's mostly a subset of C++
with different surface syntax.

In my experience, the hiring issue is "we're already behind schedule
and short-handed, we don't have the time or resources to teach people
a new language."
 
L

Lawrence D'Oliveiro

In my experience, the hiring issue is "we're already behind schedule
and short-handed, we don't have the time or resources to teach people
a new language."

Most people seem to need tutorials or handholding of some sort. Look at the
number of questions in this group which could be answered just by reading
the reference manual.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,170
Messages
2,570,927
Members
47,469
Latest member
benny001

Latest Threads

Top