Re: Why is python not written in C++ ?

2010-08-15 Thread Lawrence D'Oliveiro
In message i472rp$i4...@panix5.panix.com, Aahz wrote:

 Heck, I learned Ada as a sixteen-year-old knowing only BASIC and Pascal.

Not so surprising, considering Ada was consciously modelled on Pascal.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-14 Thread Aahz
In article i3ahdl$ce...@reader1.panix.com,
Grant Edwards  inva...@invalid.invalid wrote:

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

That's because you should be using Oberon instead.
-- 
Aahz (a...@pythoncraft.com)   * http://www.pythoncraft.com/

...if I were on life-support, I'd rather have it run by a Gameboy than a
Windows box.  --Cliff Wells
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-14 Thread Aahz
In article 7xeieevrze@ruckus.brouhaha.com,
Paul Rubin  no.em...@nospam.invalid wrote:

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.

Heck, I learned Ada as a sixteen-year-old knowing only BASIC and Pascal.
-- 
Aahz (a...@pythoncraft.com)   * http://www.pythoncraft.com/

...if I were on life-support, I'd rather have it run by a Gameboy than a
Windows box.  --Cliff Wells
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-14 Thread Lawrence D'Oliveiro
In message
44d30ac7-931e-4eb0-9aed-f664c872d...@l20g2000yqm.googlegroups.com, 
sturlamolden wrote:

 A C++ compiler can use Python's header files and link with Python's C API
 correctly. But it cannot compile Python's C source code. A C compiler
 is required to compile and build Python.

Since when do you find a C++ compiler not accompanied by a C one?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-14 Thread Grant Edwards
On 2010-08-14, Aahz a...@pythoncraft.com wrote:
 Paul Rubin  no.em...@nospam.invalid wrote:

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.

 Heck, I learned Ada as a sixteen-year-old knowing only BASIC and Pascal.

Unfortunately, there just aren't that many Aahzes to hire (sixteen
years old or otherwise), and of the non-Aahz progrommers out there
it's shocking how many of them them are apparently incapable of
learning a second language.

Regardless of how easy something is to learn, management always wants
to hire people who don't have to.

-- 
Grant


 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-12 Thread Ulrich Eckhardt
sturlamolden wrote:
 On 11 Aug, 08:40, Ulrich Eckhardt eckha...@satorlaser.com wrote:
 Header (definition) and source (implementation) is not the same. 

I'm aware of this and that's not the thing I was talking about.

Uli

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-11 Thread Ulrich Eckhardt
Martin v. Loewis wrote:
 Am 10.08.2010 09:06, schrieb Ulrich Eckhardt:
 When asked on the developers' list, it was said that this was
 intended for compatibility with C++, e.g. in cases where people
 want to embed Python into their C++ projects. Of course, this
 contradicts Christian's statement that C++ compatibility 
 wasn't considered useful enough.
 
 It doesn't contradict at all. In order to embed Python into a C++
 application, it is sufficient if the Python header files can be compiled
 with a C++ compiler, and linking to the C function works
 properly - which is indeed the case.

That's true, maybe I don't remember the exact rationale. Especially if even
someone like you, who is much deeper into Python development, doesn't, I'm
wondering if I'm misremembering something

Cheers!

Uli

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-11 Thread sturlamolden
On 11 Aug, 08:40, Ulrich Eckhardt eckha...@satorlaser.com wrote:

 That's true, maybe I don't remember the exact rationale. Especially if even
 someone like you, who is much deeper into Python development, doesn't, I'm
 wondering if I'm misremembering something

Header (definition) and source (implementation) is not the same. A C++
compiler can use Python's header files and link with Python's C API
correctly. But it cannot compile Python's C source code. A C compiler
is required to compile and build Python.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-10 Thread Ulrich Eckhardt
Carl Banks wrote:
 I highly doubt the Python source would build with a C++ compiler.

As Christian showed, it doesn't. However, look around the sources a bit.
There are lots of places where e.g. the returnvalue of malloc() (or,
rather, the macro that resolves to something like it) is explicitly
type-cast to the according pointer type. When asked on the developers'
list, it was said that this was intended for compatibility with C++, e.g.
in cases where people want to embed Python into their C++ projects. Of
course, this contradicts Christian's statement that C++ compatibility
wasn't considered useful enough.

*shrug*


Uli

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-10 Thread Lawrence D'Oliveiro
In message mailman.1863.1281378450.1673.python-l...@python.org, Christian 
Heimes wrote:

 There isn't really a point in cluttering the source with type casts.

Makes you wonder why they bothered using a typed language at all.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-10 Thread Carl Banks
On Aug 10, 12:06 am, Ulrich Eckhardt eckha...@satorlaser.com wrote:
 Carl Banks wrote:
  I highly doubt the Python source would build with a C++ compiler.

 As Christian showed, it doesn't. However, look around the sources a bit.
 There are lots of places where e.g. the returnvalue of malloc() (or,
 rather, the macro that resolves to something like it) is explicitly
 type-cast to the according pointer type. When asked on the developers'
 list, it was said that this was intended for compatibility with C++, e.g.
 in cases where people want to embed Python into their C++ projects. Of
 course, this contradicts Christian's statement that C++ compatibility
 wasn't considered useful enough.

I question why it needs to be compatible with C++ to be able to embed
Python in a C++ project.  How many C++ compilers out there don't come
bundled with a C compiler?


Carl Banks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-10 Thread Martin v. Loewis
Am 10.08.2010 09:06, schrieb Ulrich Eckhardt:
 Carl Banks wrote:
 I highly doubt the Python source would build with a C++ compiler.
 
 As Christian showed, it doesn't. However, look around the sources a bit.
 There are lots of places where e.g. the returnvalue of malloc() (or,
 rather, the macro that resolves to something like it) is explicitly
 type-cast to the according pointer type. When asked on the developers'
 list, it was said that this was intended for compatibility with C++, e.g.
 in cases where people want to embed Python into their C++ projects. Of
 course, this contradicts Christian's statement that C++ compatibility
 wasn't considered useful enough.

It doesn't contradict at all. In order to embed Python into a C++
application, it is sufficient if the Python header files can be compiled
with a C++ compiler, and linking to the C function works
properly - which is indeed the case.

People integrate Python with C++ quite often, both for embedding it
into C++, and for writing extension modules in C++.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-09 Thread Ulrich Eckhardt
candide wrote:
 Python is an object oriented langage (OOL). The Python main
 implementation is written in pure and old C90. Is it for historical
 reasons?

The fact that Python is OOP doesn't mean that the implementation of it has
to be written using an OOP language.

Other than that, I'm actually surprised that nobody mentioned that Python
actually _is_ written in C++. Yes, it's restricted to a subset thereof that
is compatible to C, but you could also claim that it was written in a
subset of C compatible to C++.

:)

Uli

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-09 Thread Carl Banks
On Aug 9, 6:39 am, Ulrich Eckhardt eckha...@satorlaser.com wrote:
 candide wrote:
  Python is an object oriented langage (OOL). The Python main
  implementation is written in pure and old C90. Is it for historical
  reasons?

 The fact that Python is OOP doesn't mean that the implementation of it has
 to be written using an OOP language.

 Other than that, I'm actually surprised that nobody mentioned that Python
 actually _is_ written in C++. Yes, it's restricted to a subset thereof that
 is compatible to C, but you could also claim that it was written in a
 subset of C compatible to C++.

 :)

I highly doubt the Python source would build with a C++ compiler.

C++ is 'mostly' 'backwards' compatible with C insofar as you can
pretty easily write C code that is also legal (and semantically
equivalent) C++.  But if you don't actively try to write code that is
compatible with both languages, chances are the C code will invoke one
of those 'minor' 'backwards' incompatibilies, the most common one
being failure to cast a pointer.


Carl Banks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-09 Thread Christian Heimes
 I highly doubt the Python source would build with a C++ compiler.
 
 C++ is 'mostly' 'backwards' compatible with C insofar as you can
 pretty easily write C code that is also legal (and semantically
 equivalent) C++.  But if you don't actively try to write code that is
 compatible with both languages, chances are the C code will invoke one
 of those 'minor' 'backwards' incompatibilies, the most common one
 being failure to cast a pointer.

Indeed:

g++ -pthread -c -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3
-Wall   -I. -IInclude -I./Include   -DPy_BUILD_CORE -o Parser/parsetok.o
Parser/parsetok.c
Parser/parsetok.c: In function 'node* parsetok(tok_state*, grammar*,
int, perrdetail*, int*)':
Parser/parsetok.c:251: error: invalid conversion from 'void*' to 'char*'
make: *** [Parser/parsetok.o] Error 1

Beside from several invalid conversions Python could most probably be
compiled with a g++ compiler. I once worked on a patch to fix the
conversion issues but Martin argued against it. There isn't really a
point in cluttering the source with type casts.

Christian

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-08 Thread Lawrence D'Oliveiro
In message 8c4g22f5l...@mid.individual.net, Gregory Ewing wrote:

 FWIW, certain parts of the Darwin kernel are written in a
 carefully-selected subset of C++. So Apple evidently think
 that it makes sense to use some C++ in a Unix kernel under
 some circumstances.

I wonder if that explains Apple’s well-known multitasking problems. :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-08 Thread Lawrence D'Oliveiro
In message l6segt@spenarnc.xs4all.nl, Albert van der Horst wrote:

 The bottom line is that to implement a programming language
 you want to use a simpler programming language, not a more
 complicated one.

That would rule out ever using a language to implement itself.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-07 Thread Gregory Ewing

Lawrence D'Oliveiro wrote:

at one 
time there was an experiment to make the kernel compilable with a C++ 
compiler, without actually using any C++ features. The result: they lost 
about 10% in speed. That was enough to put the kernel developers off taking 
the experiment any further.


FWIW, certain parts of the Darwin kernel are written in a
carefully-selected subset of C++. So Apple evidently think
that it makes sense to use some C++ in a Unix kernel under
some circumstances.

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-07 Thread Albert van der Horst
In article roy-30c94b.20362001082...@news.panix.com,
Roy Smith  r...@panix.com wrote:
In article 4c55fe82$0$9111$426a3...@news.free.fr,
 candide cand...@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 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
to it.

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.

Groetjes Albert



--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
alb...@spearc.xs4all.nl =n http://home.hccnet.nl/a.w.m.van.der.horst

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-07 Thread Albert van der Horst
In article roy-2fc4e0.19455005082...@news.panix.com,
Roy Smith  r...@panix.com wrote:
In article i3e43n$v7...@lust.ihug.co.nz,
 Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:

 In message roy-6bcfa7.22564104082...@news.panix.com, Roy Smith wrote:

  C++, for all its flaws, had one powerful feature which made it very
  popular.  It is a superset of C.

 Actually, it never was.

Yes, there are a few corner cases where valid C syntax has different
semantics in C and C++.  But, they are very few.  Calling C++ a superset
of C is essentially correct.

One aspect of C++ is that all standard functions of C are called
in the same way. A large part of programs consists of stringing
API calls together. Those require little work to upgrade to
C++. So from a practical point of view this is very much true.


It is certainly correct from the level of a risk-averse development
manager deciding if he or she is willing to use C++ for the first time.
Fear of the unknown is a powerful deterrent.  It's a lot easier to
accept something like C++ because it's just a superset of C, and we've
been using C for years.

Even if it is overhyped, the C++ compiler vendors certainly tried
to make it happen.


I suspect the same effect contributed to Java's success as well.  Look,
it's got curly braces and semicolons.  It's just like C!

Of course!

Groetjes Albert

--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
alb...@spearc.xs4all.nl =n http://home.hccnet.nl/a.w.m.van.der.horst

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-07 Thread Paul Rubin
Albert van der Horst alb...@spenarnc.xs4all.nl writes:
 We had a similar discussion on comp.lang.forth.

Heh, fancy meeting you here ;-)

 The bottom line is that to implement a programming language
 you want to use a simpler programming language, not a more
 complicated one. 

Nah, gas is written in C, and nobody implements VHDL as logic gates.

 (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.)

Haskell (or at least certain parts of it) should probably be implemented
in Coq or Agda, which are even higher level than Haskell.

 Undoubtedly C is the right choice to implement Python.

Python has been experimentally implemented in Haskell:

  http://hackage.haskell.org/package/berp-0.0.2

but the most interesting implementation (not yet ready for production,
but a serious ongoing project partly funded by the EU) is written in
Python itself:

   http://codespeak.net/pypy/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-06 Thread David Cournapeau
On Fri, Aug 6, 2010 at 8:45 AM, Roy Smith r...@panix.com wrote:
 In article i3e43n$v7...@lust.ihug.co.nz,
  Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:

 In message roy-6bcfa7.22564104082...@news.panix.com, Roy Smith wrote:

  C++, for all its flaws, had one powerful feature which made it very
  popular.  It is a superset of C.

 Actually, it never was.

 Yes, there are a few corner cases where valid C syntax has different
 semantics in C and C++.  But, they are very few.  Calling C++ a superset
 of C is essentially correct.

This is only true if you limit yourself to C89 (as python seems to
do). If  you start using C99 (and lot of people do, if only because
they don't realize it because gcc is quite relax about it), then
almost no non trivial C code is valid C++ in my experience.

David
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-06 Thread Roy Smith
In article mailman.1666.1281075732.1673.python-l...@python.org,
 David Cournapeau courn...@gmail.com wrote:

  Yes, there are a few corner cases where valid C syntax has different
  semantics in C and C++.  But, they are very few.  Calling C++ a superset
  of C is essentially correct.
 
 This is only true if you limit yourself to C89 (as python seems to
 do). If  you start using C99 (and lot of people do, if only because
 they don't realize it because gcc is quite relax about it), then
 almost no non trivial C code is valid C++ in my experience.

I'm not following you.  If anything, C99 makes C closer to C++.  Can you 
give me some examples of valid C99 which is not also valid C++?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-06 Thread David Cournapeau
On Fri, Aug 6, 2010 at 8:39 PM, Roy Smith r...@panix.com wrote:
 In article mailman.1666.1281075732.1673.python-l...@python.org,
  David Cournapeau courn...@gmail.com wrote:

  Yes, there are a few corner cases where valid C syntax has different
  semantics in C and C++.  But, they are very few.  Calling C++ a superset
  of C is essentially correct.

 This is only true if you limit yourself to C89 (as python seems to
 do). If  you start using C99 (and lot of people do, if only because
 they don't realize it because gcc is quite relax about it), then
 almost no non trivial C code is valid C++ in my experience.

 I'm not following you.  If anything, C99 makes C closer to C++.  Can you
 give me some examples of valid C99 which is not also valid C++?

variable size array, the meaning of inline, etc... In addition to int
f(void) vs int f(), legality vs illegality of p = malloc(n);, type of
enum, keyword incompatibility (new, delete, etc...) which are already
there in C89.

I have yet seen a project where you could build C code with a C++
compiler - the only ones I know are specifically designed that way and
it is painful.

David
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-06 Thread Lawrence D'Oliveiro
In message mailman.1681.1281102958.1673.python-l...@python.org, David 
Cournapeau wrote:

 I have yet seen a project where you could build C code with a C++
 compiler - the only ones I know are specifically designed that way and
 it is painful.

I seem to recall a FAQ entry, might have been on kernelnewbies.org, asking 
why the Linux kernel wasn’t written in C++. The answer explained that at one 
time there was an experiment to make the kernel compilable with a C++ 
compiler, without actually using any C++ features. The result: they lost 
about 10% in speed. That was enough to put the kernel developers off taking 
the experiment any further.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-05 Thread Lawrence D'Oliveiro
In message 7xocdi56cp@ruckus.brouhaha.com, Paul Rubin wrote:

 I'd say the Ada standardizers went to a great deal of trouble to specify
 and document stuff that other languages simply leave undefined, leaving
 developers relying on implementation-specific behavior that's not part
 of the standard.

OK, I have a copy of KR 2nd Ed on a shelf within reach here. Can you point 
out some behaviour that C programmers might need to rely on, that is not 
specified in that document?

 Ada itself is not necessarily more complicated.

It is. Look at its baroque type structure. Hint: why is

type A is B;

a syntax error?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-05 Thread Lawrence D'Oliveiro
In message roy-6bcfa7.22564104082...@news.panix.com, Roy Smith wrote:

 C++, for all its flaws, had one powerful feature which made it very
 popular.  It is a superset of C.

Actually, it never was.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-05 Thread Christoffer Viken
C++ is actually not that bad.
Can't compare it to C, but nothing compares to C...
I think the bad reputation it got (and still has) is from Microsoft's visual
studio IDE (that was and still is horrible)
A lot of good applications are written in C++, but many bad ones as well.

Sorry for swearing in the church, but I'm pulling out PHP as an example.
Easy on beginners, the fat that you can jump in and out of PHP mode helps
too. It attracts a lot of beginner developers, and most of them write bad
code. It does not make the language a bad language, in fact PHP5 is pretty
good, but it means that there is a lot of bad code out there, but then we
have gems like MediaWiki and Drupal that is really good software.

You can write bad code in any language, and many languages get a bad
reputation because a lot of bad code is written in it.
The real test is not how bad code you can write, but the limit for how good
code you can write without jumping trough (too manny) hoops.

On Thu, Aug 5, 2010 at 12:34 PM, Lawrence D'Oliveiro
l...@geek-central.gen.new_zealand wrote:

 In message roy-6bcfa7.22564104082...@news.panix.com, Roy Smith wrote:

  C++, for all its flaws, had one powerful feature which made it very
  popular.  It is a superset of C.

 Actually, it never was.
 --
 http://mail.python.org/mailman/listinfo/python-list




-- 
--Desktop Browser, Google Apps -
Christoffer Viken / CVi

i=0

str=kI4dJMtXAv0m3cUiPKx8H

while i=20:

if i%3 and not i%4:

print str[i],

i=i+1
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-05 Thread Paul Rudin
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes:

 In message roy-6bcfa7.22564104082...@news.panix.com, Roy Smith wrote:

 C++, for all its flaws, had one powerful feature which made it very
 popular.  It is a superset of C.

 Actually, it never was.

Wondering off topic a bit - I am reminded of something I once read in
some MS blurb... it described something as an extended subset of some
standard or another. (Think about it :))
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-05 Thread Tim Chase

On 08/05/10 05:33, Lawrence D'Oliveiro wrote:

OK, I have a copy of KR 2nd Ed on a shelf within reach here. Can you point
out some behaviour that C programmers might need to rely on, that is not
specified in that document?


need to is considerably different from might.  Size of an 
int, assumptions that int=pointer, evaluation order of postfix 
increment/decrement...


http://stackoverflow.com/questions/625333/how-to-limit-the-impact-of-implementation-dependent-language-features-in-c

or http://tinyurl.com/263jayy if mailers between here  there 
break the URL)


Just because facilities (macros, best-practices, etc) have been 
established for some of these things doesn't mean a programmer 
will reach for them if their code happens to work locally without 
them.  Trust me...I've encountered PLENTY of such code in 
production before I left behind (for the most part) the world of C.


-tkc




--
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-05 Thread Edward Diener

On 8/2/2010 5:42 PM, Mark Lawrence wrote:

On 02/08/2010 00:08, candide 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.

Has it ever been planned to rewrite in C++ the historical implementation
(of course in an object oriented design) ?


I can't understand why any serious programmer mentions C++. As soon as I
read it, I have to rush either to the kitchen to find a bowl to throw up
in, or head for the toilet so I can talk to the great white telephone.


It must be because we can not be as phenomenally intelligent as you 
evidently are from your comment.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-05 Thread Paul Rubin
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes:
 OK, I have a copy of KR 2nd Ed on a shelf within reach here. Can you point 
 out some behaviour that C programmers might need to rely on, that is not 
 specified in that document?

C has all kinds of undefined behavior.  Might need to rely on is not
relevant for this kind of issue.  Ada's designers had the goal that that
Ada programs should have NO undefined behavior. 

As a famous example of C's underspecification, the behavior of

   a[i++] = i;

is undefined in C99.  See:

https://www.securecoding.cert.org/confluence/display/seccode/EXP30-C.+Do+not+depend+on+order+of+evaluation+between+sequence+points
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-05 Thread Britt
On Aug 1, 9:34 pm, Albert Hopkins mar...@letterboxes.org wrote:
 On Mon, 2010-08-02 at 01:08 +0200, candide wrote:

 I would propose that in fact most programming languages are implemented
 in C.  Sun's (Oracle's) Java compiler and runtime are written in ANSI C.
 The core of the Gnu Compiler Collection (which includes C++ and
 Objective-C compilers) is written in C.

The open-source GCC Ada compiler (GNAT) is written in Ada. The GPL'd
compiler source code is available at http://libre.adacore.com/libre/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-05 Thread Neil Hodgson
Paul Rubin:

 C has all kinds of undefined behavior.  Might need to rely on is not
 relevant for this kind of issue.  Ada's designers had the goal that that
 Ada programs should have NO undefined behavior.

   Ada achieves this by describing a long list of implementation defined
behaviour (Annex M).
http://oopweb.com/Ada/Documents/Ada95RM/Volume/m.htm

 As a famous example of C's underspecification, the behavior of
 
a[i++] = i;
 
 is undefined in C99.

   Ada does not define ordering in all cases either. For example the
order of elaboration of library_items (essentially the order in which
modules are run in the absence of explicit declarations) is defined for
GNAT as


first elaborating bodies as early as possible (i.e. in preference to
specs where there is a choice), and second by evaluating the immediate
with clauses of a unit to determine the probably best choice, and third
by elaborating in alphabetical order of unit names where a choice still
remains


   Other compilers use different orders.

   I just love that probably.

   Neil
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-05 Thread Roy Smith
In article i3e43n$v7...@lust.ihug.co.nz,
 Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:

 In message roy-6bcfa7.22564104082...@news.panix.com, Roy Smith wrote:
 
  C++, for all its flaws, had one powerful feature which made it very
  popular.  It is a superset of C.
 
 Actually, it never was.

Yes, there are a few corner cases where valid C syntax has different 
semantics in C and C++.  But, they are very few.  Calling C++ a superset 
of C is essentially correct.

It is certainly correct from the level of a risk-averse development 
manager deciding if he or she is willing to use C++ for the first time.  
Fear of the unknown is a powerful deterrent.  It's a lot easier to 
accept something like C++ because it's just a superset of C, and we've 
been using C for years.

I suspect the same effect contributed to Java's success as well.  Look, 
it's got curly braces and semicolons.  It's just like C!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Paul Rubin
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes:
 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.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread 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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Lawrence D'Oliveiro
In message pv76o.2574$yv@viwinnwfe01.internal.bigpond.com, Neil 
Hodgson wrote:

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.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Lawrence D'Oliveiro
In message pan.2010.08.03.08.35.59.328...@nowhere.com, Nobody wrote:

 One feature which can't readily be implemented in C is the automatic
 clean-up side of the RAII idiom.

Use do-once blocks
http://www.geek-central.gen.nz/peeves/programming_discipline.html.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Lawrence D'Oliveiro
In message 
7d95c0d3-718d-4958-9364-263c833f1...@i24g2000yqa.googlegroups.com, 
sturlamolden wrote:

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

Only if they’re using exceptions. Otherwise, it’s fine.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Jean-Michel Pichavant

Carl Banks wrote:

On Aug 3, 7:07 pm, Paul Rubin no.em...@nospam.invalid wrote:
  

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
  

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

JM
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Grant Edwards
On 2010-08-04, Paul Rubin no.em...@nospam.invalid wrote:
 Grant Edwards inva...@invalid.invalid writes:

 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.

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

 I think I'm a reasonably good Python programmer but I've never
 written a special metaclass and wouldn't really know how to.

-- 
Grant Edwards   grant.b.edwardsYow! I would like to
  at   urinate in an OVULAR,
  gmail.comporcelain pool --
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Grant Edwards
On 2010-08-04, Paul Rubin no.em...@nospam.invalid wrote:

 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.

-- 
Grant Edwards   grant.b.edwardsYow! Did YOU find a
  at   DIGITAL WATCH in YOUR box
  gmail.comof VELVEETA?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Grant Edwards
On 2010-08-04, Neil Hodgson nyamatongwe+thun...@gmail.com wrote:
 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

Wow.  That's grown a lot over the years.  I used to have a paper copy,
(single-sided), and it was only about 1cm thick.  Ok, I guess that was
probably 20 years ago...

-- 
Grant Edwards   grant.b.edwardsYow! I wonder if I ought
  at   to tell them about my
  gmail.comPREVIOUS LIFE as a COMPLETE
   STRANGER?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Lawrence D'Oliveiro
In message i3bsjf$kf...@reader1.panix.com, Grant Edwards wrote:

 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.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Lawrence D'Oliveiro
In message i3bseh$kf...@reader1.panix.com, Grant Edwards wrote:

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

So how was C++ able to get popular in the first place? And how was Java able 
to grab some share from it?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Paul Rubin
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes:
  The Ada 2012 Language Reference Manual is 860 pages ...
 Yeah, unfortunately the language was designed by a committee ...
 It seems apt to describe the resulting design as “bulletproof”, but 
 “elegant” or “concise” ... not so much.

I'd say the Ada standardizers went to a great deal of trouble to specify
and document stuff that other languages simply leave undefined, leaving
developers relying on implementation-specific behavior that's not part
of the standard.  Ada itself is not necessarily more complicated.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Grant Edwards
On 2010-08-04, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:
 In message i3bseh$kf...@reader1.panix.com, Grant Edwards wrote:

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

 So how was C++ able to get popular in the first place?

Building on C's popularity helped.

 And how was Java able to grab some share from it?

Good question.  Both IBM and Sun put a lot of effort/money behind
Java.

-- 
Grant

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Paul Rubin
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes:
 So how was C++ able to get popular in the first place? And how was
 Java able to grab some share from it?

C++ made improvements over C that were necessary and welcome for
controlling the complexity of large programs, while remaining mostly
upward compatible with C.  Java abandoned C compatibility and added
memory safety and GC.  That got rid of legacy-related pain and improved
program reliability and eased debugging considerably, at some cost in
performance.  Java was also on the OO bandwagon of the 1990's, which
translated into good marketing back then, but is part of the cause of
the massive bureaucracy and bloat in the Java runtime environment.  C++
seems to have made something of a comeback because of this, and Java now
has generics patterned after C++'s.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Carl Banks
On Aug 4, 4:04 pm, Grant Edwards inva...@invalid.invalid wrote:
 On 2010-08-04, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:

  In message i3bseh$kf...@reader1.panix.com, Grant Edwards wrote:

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

  So how was C++ able to get popular in the first place?

 Building on C's popularity helped.

ATT + Money + C backward compatibility


  And how was Java able to grab some share from it?

 Good question.  Both IBM and Sun put a lot of effort/money behind
 Java.

Sun + IBM + Money + 90s Web trinkets


Carl Banks

(haven't seen a Java applet in ages)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Carl Banks
On Aug 4, 4:23 pm, Paul Rubin no.em...@nospam.invalid wrote:
 Java was also on the OO bandwagon of the 1990's, which
 translated into good marketing back then, but is part of the cause of
 the massive bureaucracy and bloat in the Java runtime environment.  C++
 seems to have made something of a comeback because of this, and Java now
 has generics patterned after C++'s.

When I first studied Java, my first impression of the language was
that it had a Prime Directive that, other than single inheritance and
being kinda like C, don't do anything C++ did.

Not a bad policy, actually.  However, omitting generics was probably
the second worst thing about Java (the worst thing being the awful AWT
design).


Carl Banks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-04 Thread Roy Smith
In article i3cqia$82...@lust.ihug.co.nz,
 Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:

 In message i3bseh$kf...@reader1.panix.com, Grant Edwards wrote:
 
  The problem has nothing to do with the relative merits of the
  languages.  The problem is inertia.
 
 So how was C++ able to get popular in the first place? And how was Java able 
 to grab some share from it?

C++, for all its flaws, had one powerful feature which made it very 
popular.  It is a superset of C.  Whatever that may mean from a 
technical standpoint, it made the language feel safe and comfortable and 
low-risk to managers.  From a more technical standpoint, it had the very 
real advantage of being able to include all the C system headers and 
link against C system libraries.

As for Java, that's easy.  You could launch Java applets from inside a 
web browser.  In those days, anything related to the web was a one-way 
express ticket to fame and fortune.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Nobody
On Mon, 02 Aug 2010 17:17:35 -0700, Peter wrote:

 But I always used to tell
 people - by the time I got a program to compile then I figured 99% of
 the bugs were already discovered! Try that with C/C++ or almost any
 other language you care to name :-)

ML and Haskell are also quite good for this (although I wish they
supported integer subranges). Also, the statelessness of FP eliminates
entire classes of bugs.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Nobody
On Mon, 02 Aug 2010 15:18:30 -0700, sturlamolden wrote:

 Has it ever been planned to rewrite in C++ the historical implementation
 (of course in an object oriented design) ?
 
 OO programming is possible in C.  Just take a look at GNOME and GTK.

One feature which can't readily be implemented in C is the automatic
clean-up side of the RAII idiom.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Chris Rebert
On Tue, Aug 3, 2010 at 1:36 AM, Nobody nob...@nowhere.com wrote:
 On Mon, 02 Aug 2010 15:18:30 -0700, sturlamolden wrote:
 Has it ever been planned to rewrite in C++ the historical implementation
 (of course in an object oriented design) ?

 OO programming is possible in C.  Just take a look at GNOME and GTK.

 One feature which can't readily be implemented in C is the automatic
 clean-up side of the RAII idiom.

That's not directly related to object-orientation though.

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread James Mills
On Tue, Aug 3, 2010 at 6:36 PM, Nobody nob...@nowhere.com wrote:
 One feature which can't readily be implemented in C is the automatic
 clean-up side of the RAII idiom.

C is a Turing-Complete Language is it not ?

If so, therefore is it not true anything can be implemented ?
Even the automated clean-up side of the RAIL idiom ?

cheers
James

-- 
-- James Mills
--
-- Problems are solved by method
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Steven D'Aprano
On Tue, 03 Aug 2010 18:48:24 +1000, James Mills wrote:

 On Tue, Aug 3, 2010 at 6:36 PM, Nobody nob...@nowhere.com wrote:
 One feature which can't readily be implemented in C is the automatic
 clean-up side of the RAII idiom.
 
 C is a Turing-Complete Language is it not ?
 
 If so, therefore is it not true anything can be implemented ? Even the
 automated clean-up side of the RAIL idiom ?

True, but Nobody said it can't *readily* be implemented, not that it 
can't be.




-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread James Mills
On Tue, Aug 3, 2010 at 7:04 PM, Steven D'Aprano
steve-remove-t...@cybersource.com.au wrote:
 True, but Nobody said it can't *readily* be implemented, not that it
 can't be.

So he did too :) I read that as really :/

--James

-- 
-- James Mills
--
-- Problems are solved by method
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread John Bokma
Carl Banks pavlovevide...@gmail.com writes:

 On Aug 1, 6:09 pm, John Bokma j...@castleamber.com wrote:
 Roy Smith r...@panix.com writes:
  In article 4c55fe82$0$9111$426a3...@news.free.fr,
   candide cand...@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.

 The virtual table of this class:

 class Bar {
 virtual int foo(int);
 virtual int bar(int);
 };

 might be generated like this in one cfront:

 struct Bar$$Vtable$ {
 int (*Bar$$bar$d)(int);
 int (*Bar$$foo$d)(int);
 };

 and like this in another:

 struct class_Foo___vtable_ {
 int (*foo)(int);
 int (*bar)(int);
 };


 So, just because they both generated C code, it doesn't mean they can
 call one another.

Why would they need to call each other? The compiled C++ code ends up as
being compiled generated C code.

It has been a while, but I am quite sure that the Acorn C++ front end I
used could dump the actual generated C code. And this generated code
should compile with a normal C compiler on a different platform.

The only exception I can think of is if the front end comes with
libraries you have to link against. But since this should be C as well
(since there is no native C++), I don't see any problem to recreate
those libraries.

-- 
John Bokma   j3b

Hacking  Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl  Python Development
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread John Bokma
Albert Hopkins mar...@letterboxes.org writes:

 But I wonder if someone has/has tried to write a programming language in
 C++ and what were their experiences.

  The Low Level Virtual Machine (LLVM) is a compiler infrastructure,
  written in C++, which is designed for compile-time, link-time,
  run-time, and idle-time optimization of programs written in
  arbitrary programming languages. Originally implemented for C/C++, the
  language-independent design (and the success) of LLVM has since
  spawned a wide variety of front ends, including Objective-C, Fortran,
  Ada, Haskell, Java bytecode, Python, Ruby, ActionScript, GLSL, and
  others.

http://en.wikipedia.org/wiki/LLVM

  Unladen Swallow is a branch of Python intended to be fully compatible
  and significantly faster. It uses LLVM's optimization passes and JIT
  compiler.

http://llvm.org/ProjectsWithLLVM/#unladenswallow

-- 
John Bokma   j3b

Hacking  Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl  Python Development
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread John Bokma
Michael Torrie torr...@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).

-- 
John Bokma   j3b

Hacking  Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl  Python Development
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Nobody
On Tue, 03 Aug 2010 18:48:24 +1000, James Mills wrote:

 One feature which can't readily be implemented in C is the automatic
 clean-up side of the RAII idiom.
 
 C is a Turing-Complete Language is it not ?
 
 If so, therefore is it not true anything can be implemented ?
 Even the automated clean-up side of the RAIL idiom ?

By automated, I mean the fact that destructors get called automatically
when a local variable goes out of scope, whether by reaching the end of
the block, return, break, continue, or an exception.

In C, the clean-up has to be made explicit, i.e. not automated.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Paul Rubin
Nobody nob...@nowhere.com writes:
 One feature which can't readily be implemented in C is the automatic
 clean-up side of the RAII idiom.

I once did that by having an explicit stack of finalization records
linked through the call stack.  The throw routine would traverse the
links to call the finalizers, until it found the matching catch which
contained a longjmp target.  It wasn't as crazy as this makes it sound.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Grant Edwards
On 2010-08-02, Aahz a...@pythoncraft.com wrote:
 In article f9e652d6-3945-4c18-92f3-b85b994fe...@k8g2000prh.googlegroups.com,
 Peter  peter.milli...@gmail.com wrote:
On Aug 3, 7:42=A0am, Mark Lawrence breamore...@yahoo.co.uk wrote:
 On 02/08/2010 00:08, candide wrote:

 I can't understand why any serious programmer mentions C++. As soon
 as I read it, I have to rush either to the kitchen to find a bowl to
 throw up in, or head for the toilet so I can talk to the great white
 telephone.

With you there Mark - IMO C++ is an abortion that should never have
seen the light of day. The idea of experimenting with creating an OO
language by extending C wasn't such a bad idea for a play thing (by
Stroustrop) but the fact that it somehow escaped from the Lab and
people picked it up and ran with it on a commercial basis is just
plain wrong!

 http://www.netfunny.com/rhf/jokes/98/May/stroustrup.html

It's funny (and sad) because it's so close to being true.

(The effect, I mean, not necissarly the intent.)

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

-- 
Grant Edwards   grant.b.edwardsYow! Should I get locked
  at   in the PRINCICAL'S
  gmail.comOFFICE today -- or have
   a VASECTOMY??
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Grant Edwards
On 2010-08-02, Paul Rubin no.em...@nospam.invalid wrote:
 Michael Torrie torr...@gmail.com writes:
 Sometimes, C++ is just the right tool for the job, despite all its
 warts  C++'s object semantics (guaranteed destruction, scoping,
 etc) can sometimes work very well when you need the speed of a
 compiled language, but don't want to be quite as low-level as C.
 
 In this case, C++ is certainly not a better tool for the job than C.

 The stuff C++ adds to C is a mix of good and bad, and it's reasonably
 possible to use just the good stuff and ignore the bad.

Except nobody does. ;)

 I've never programmed in Ada but I'm intrigued by these articles:

   http://adahome.com/Ammo/cpp2ada.html 
   http://www.adaic.org/whyada/ada-vs-c/cada_art.html

 I have the impression that Ada has an undeservedly bad rap because of
 its early implementations and its origins in military bureaucracy. 
 I'd certainly consider it as an alternative to C or C++ if I had to
 write a big program in a traditional procedural language.

I've always thought Ada was a pretty nice embedded/systems languages,
but some of the initial implementations were indede horrible. The one
I used for a little while ran on VAX/VMS but didn't use the VMS
filesystem, editors, or other utilities.  The Ada enviroment was a
completely closed, walled system.  It kept it's files in some sort
of opaque database and they could only be accessed, edited, compiled,
etc. from within the Ada development enviornment (a system with
really, really awful editing and build tools).  There was a way to
import/export files, but it wasn't easy. Still, the Ada-environment
tools were _so_ bad that people exported a file, edited it using some
VMS-based editor and the re-imported it whenever a change needed to be
made.

Apparently the intent was to provide the identically awful
user-torturing-experience regardless of OS.

-- 
Grant Edwards   grant.b.edwardsYow! I represent a
  at   sardine!!
  gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Carl Banks
On Aug 3, 2:29 am, John Bokma j...@castleamber.com wrote:
 Carl Banks pavlovevide...@gmail.com writes:
  On Aug 1, 6:09 pm, John Bokma j...@castleamber.com wrote:
  Roy Smith r...@panix.com writes:
   In article 4c55fe82$0$9111$426a3...@news.free.fr,
    candide cand...@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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Ethan Furman

John Bokma wrote:

Michael Torrie torr...@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?


~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread John Nagle

On 8/1/2010 5:36 PM, Roy Smith wrote:

In article4c55fe82$0$9111$426a3...@news.free.fr,
  candidecand...@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
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Benjamin Kaplan
On Tue, Aug 3, 2010 at 10:44 AM, John Nagle na...@animats.com wrote:

 On 8/1/2010 5:36 PM, Roy Smith wrote:

 In article4c55fe82$0$9111$426a3...@news.free.fr,
  candidecand...@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
 --



Pretty sure that's only one Windows, and only because they need to be linked
to the same version of MSVC. It's not a compiler issue, it's incompatible
library versions.


 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Paul Rubin
Grant Edwards inva...@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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread John Bokma
Carl Banks pavlovevide...@gmail.com writes:

 On Aug 3, 2:29 am, John Bokma j...@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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread John Bokma
Ethan Furman et...@stoneleaf.us writes:

 John Bokma wrote:
 Michael Torrie torr...@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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Ethan Furman

John Bokma wrote:

Ethan Furman et...@stoneleaf.us writes:


John Bokma wrote:

Michael Torrie torr...@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.


Huh?  Presumably Python itself is not a library, and the extension may 
not be a library, at some point they will have different name mangling 
schemes... are you suggesting that after going through the effort if 
writing all this in C++ you would then have to write a wrapper in C so 
the two could talk to each other?


~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Carl Banks
On Aug 3, 3:19 pm, John Bokma j...@castleamber.com wrote:
 Carl Banks pavlovevide...@gmail.com writes:
  On Aug 3, 2:29 am, John Bokma j...@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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Roy Smith
In article 87aap3uyo7@castleamber.com,
 John Bokma j...@castleamber.com wrote:

  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 didn't intend to claim quite that much.  I'm just saying it's a 
consideration.  I was not privy to the original design decisions.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Martin v. Loewis
 Has it ever been planned to rewrite in C++ the historical implementation
 (of course in an object oriented design) ?

Around the time Guido coined the term Python 3000 (i.e. in 2000), he
also said at a few occasions that it would be written in C++. He
subsequently dropped the idea, for the reasons that people have been
discussing.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Lawrence D'Oliveiro
In message i3982t$79...@reader1.panix.com, Grant Edwards wrote:

 I've always thought Ada was a pretty nice embedded/systems languages,
 but some of the initial implementations were indede horrible.

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.

Disclaimer: the most complicated Ada program I’ve ever written is this 
http://www.codecodex.com/wiki/Concurrent_Quicksort. Or maybe this 
http://www.codecodex.com/wiki/Parallel_Sieve_of_Eratosthenes. :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Grant Edwards
On 2010-08-04, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:
 In message i3982t$79...@reader1.panix.com, Grant Edwards wrote:

 I've always thought Ada was a pretty nice embedded/systems languages,
 but some of the initial implementations were indede horrible.

 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.

-- 
Grant

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Paul Rubin
Grant Edwards inva...@invalid.invalid writes:
 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 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Grant Edwards
On 2010-08-04, Paul Rubin no.em...@nospam.invalid wrote:
 Grant Edwards inva...@invalid.invalid writes:

 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.

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

-- 
Grant

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Paul Rubin
Grant Edwards inva...@invalid.invalid writes:
 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.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread sturlamolden
On 4 Aug, 04:41, Grant Edwards inva...@invalid.invalid wrote:

 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.



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Carl Banks
On Aug 3, 7:07 pm, Paul Rubin no.em...@nospam.invalid wrote:
 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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Roy Smith
In article 
ba47afb4-5798-41da-85d3-bb60cf97c...@c10g2000yqi.googlegroups.com,
 sturlamolden sturlamol...@yahoo.no wrote:

 On 4 Aug, 04:41, Grant Edwards inva...@invalid.invalid wrote:
 
  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.

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.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Lawrence D'Oliveiro
In message 7xmxt3uo4h@ruckus.brouhaha.com, Paul Rubin wrote:

 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++?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Lawrence D'Oliveiro
In message i3ajvt$93...@reader1.panix.com, Grant Edwards wrote:

 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...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-03 Thread Lawrence D'Oliveiro
In message roy-00f9bf.4104082...@news.panix.com, Roy Smith wrote:

 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. :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-02 Thread Tim Wintle
On Sun, 2010-08-01 at 20:01 -0400, Terry Reedy wrote:
 Not every C programmer knows or wants to learn C++.

I think Terry is the only person that's mentioned this - but I'd like to
give extra support to it - I for one prefer C to C++ (as someone that
writes quite a lot of C extension modules).

And as Stephen mentioned - just because C is not an OO language, doesn't
mean you can't write OO code in it - you just have to pass an instance
of the class method is defined on in as the first parameter (like you do
in Python).


Tim

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-02 Thread Grant Edwards
On 2010-08-02, Christian Heimes li...@cheimes.de wrote:

 In your opinion what would Python gain from a C++ implementation?

Greater buzzword-compliance -- an important characteristic highly
prized by Human-Resources poeple and mid-level managers here in the
US.

;)

-- 
Grant

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-02 Thread David Cournapeau
On Mon, Aug 2, 2010 at 10:20 AM, Christian Heimes li...@cheimes.de wrote:


 In your opinion what would Python gain from a C++ implementation?

The elusive advantages of OO in C++ are relatively minor compared to
RIIA which would make reference counting much easier to deal with. But
even that is not a strong enough argument for C++. The little C++ we
have in scipy had causes a lot of headache - C++ portability is still
an issue once you are outside the 4-5 main OS/Compilers combinations,

David
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-02 Thread Thomas Jollans
On 08/02/2010 04:42 PM, Grant Edwards wrote:
 On 2010-08-02, Christian Heimes li...@cheimes.de wrote:
 
 In your opinion what would Python gain from a C++ implementation?
 
 Greater buzzword-compliance -- an important characteristic highly
 prized by Human-Resources poeple and mid-level managers here in the
 US.
 
 ;)
 

C++Python would never beat IronPython on that front
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-02 Thread Mithrandir
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/01/2010 07:34 PM, Albert Hopkins wrote:
 On Mon, 2010-08-02 at 01:08 +0200, candide 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.

 Has it ever been planned to rewrite in C++ the historical implementation 
 (of course in an object oriented design) ?
 
 Disclaimer: I am neither a C nor C++ programmer.  In fact I can barely
 even program in Python ;-)
 
 I would propose that in fact most programming languages are implemented
 in C.  Sun's (Oracle's) Java compiler and runtime are written in ANSI C.
 The core of the Gnu Compiler Collection (which includes C++ and
 Objective-C compilers) is written in C.  The official Ruby is
 implemented in C. The Squeak Smalltalk implementation uses C instead of
 C++.  I can't even think of a programming language that is implemented
 in C++ (maybe C++ is).
 
 C seems to be a good, portable language for writing interpreters and
 compilers.
 
 But I wonder if someone has/has tried to write a programming language in
 C++ and what were their experiences.
 

(Sorry if this is a double post, but apparently my last one didn't go
through.)

I know that LOLCode has a .NET implementation (1), although it's very
much alpha.  And someone was apparently working on a C++ only
implementation of LOLCode (2), although that was 3 years ago.

LOLCode itself is very much alpha anyway and development seems to be
very slow (or dead.)

Python has a way of extending it's modules with C or C++ (3).

1: http://lolcode.com/implementations/lolcode.net
2: http://forum.lolcode.com/viewtopic.php?id=14
3: http://docs.python.org/release/2.5.2/ext/intro.html

- -- 
People should read more.
https://secure.wikimedia.org/wikipedia/en/wiki/User:MithrandirAgain
All that is gold does not glitter,
not all those who wander are lost;
the old that is strong does not wither,
deep roots are not reached by the frost.
- From the ashes a fire shall be woken,
a light from the shadows shall spring;
renewed shall be blade that was broken,
the crownless again shall be king.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJMVyNqAAoJEKo37V1xH7gTeOUH/2/KYc4busZbATSB09ZUgW+v
BmydxDTZaPQd0B56JWSeUiz0/kZrufdDrVc3XUTNNF2oa8ExW51IgsaZOxn2UJGv
ydplycT1axs5hrzDG72v2Oo7/poPDxSsvpF58dBsb0XSI25I+orHKrTQpwvKz9cf
x6nzahUoygTbaVqZUyxCW2Tc7Rv4T2gpskssD8sIYqaRNofNnPbf3h3NA+q4LMkR
+F2UF3r1RE1jwJhs6RNAvUJBdLrHkA3isRsjQE38l6AioLdeTs2yrRtc+6xUkAig
RxR11qLZl5OOer/Jrmg1My0+ZTYGnIcAfChxPh1YnHuYbp+H7doqLjlKIkoXZms=
=F9Ou
-END PGP SIGNATURE-
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-02 Thread Mark Lawrence

On 02/08/2010 00:08, candide 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.

Has it ever been planned to rewrite in C++ the historical implementation
(of course in an object oriented design) ?


I can't understand why any serious programmer mentions C++. As soon as I 
read it, I have to rush either to the kitchen to find a bowl to throw up 
in, or head for the toilet so I can talk to the great white telephone.


Kindest regards.

Mark Lawrence.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-02 Thread Peter
On Aug 3, 7:42 am, Mark Lawrence breamore...@yahoo.co.uk wrote:
 On 02/08/2010 00:08, candide wrote:
snip

 I can't understand why any serious programmer mentions C++. As soon as I
 read it, I have to rush either to the kitchen to find a bowl to throw up
 in, or head for the toilet so I can talk to the great white telephone.

 Kindest regards.

 Mark Lawrence.

With you there Mark - IMO C++ is an abortion that should never have
seen the light of day. The idea of experimenting with creating an OO
language by extending C wasn't such a bad idea for a play thing (by
Stroustrop) but the fact that it somehow escaped from the Lab and
people picked it up and ran with it on a commercial basis is just
plain wrong!

Personally I liken it to one of those genetically engineered diseases
they play around with in biological warfare labs - and unfortunately
this one escaped! It has probably set the computing industry back
untold years in terms of advancement...

Unfortunately I am forced to use it in my day to day life, but at the
end of every day I go home and use a purgative to get it out of my
system. But there are many deluded youngsters out there who just don't
seem to know any better, but then the signs of the breakdown of
society surround us on a daily basis and I guess C++ is just another
signpost on the way...

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-02 Thread Michael Torrie
On 08/02/2010 03:42 PM, Mark Lawrence wrote:
 I can't understand why any serious programmer mentions C++. As soon as I 
 read it, I have to rush either to the kitchen to find a bowl to throw up 
 in, or head for the toilet so I can talk to the great white telephone.

Sometimes, C++ is just the right tool for the job, despite all its
warts.  For example, programming GTK apps with GTKmm in C++ is way more
pleasant than using C (but nowhere as pleasant as Python).  C++'s object
semantics (guaranteed destruction, scoping, etc) can sometimes work very
well when you need the speed of a compiled language, but don't want to
be quite as low-level as C.

In this case, C++ is certainly not a better tool for the job than C.
But plenty of serious programmers know how to leverage C++ and do so
quite successfully.  Just because C++ makes you ill in no way proves
that C++ is unfit for certain purposes.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 2 Aug, 01:08, candide cand...@free.invalid wrote:

 Has it ever been planned to rewrite in C++ the historical implementation
 (of course in an object oriented design) ?

OO programming is possible in C.  Just take a look at GNOME and GTK.

Perl is written in C++. That is not enough to make me want to use
it ;)

To be honest, C++ can be a great tool. But very few know how to use it
correctly. C++ textbooks are also written by people who don't
understand the language, and teach bad habits. The typical examples
revealing incompetence are use of new[] instead of std::vector, and
dynamic resourse allocation outside contructors.

C++ compilers used to be bloatware generators; C++ compilers of 2010
are not comparable to those of 1990. C++ is also a PITA for
portability. It is not sufficient for Python to only build with
Microsoft Visual Studio.








-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-02 Thread Paul Rubin
Michael Torrie torr...@gmail.com writes:
 Sometimes, C++ is just the right tool for the job, despite all its
 warts  C++'s object semantics (guaranteed destruction, scoping,
 etc) can sometimes work very well when you need the speed of a
 compiled language, but don't want to be quite as low-level as C.
 
 In this case, C++ is certainly not a better tool for the job than C.

The stuff C++ adds to C is a mix of good and bad, and it's reasonably
possible to use just the good stuff and ignore the bad.  At that point
you've got a pure improvement over C, although a lot of C's shortcomings
can't be papered over and still remain.

Certain folks in the functional-programming community consider OO to be
a 1980's or 1990's approach that didn't work out, and that what it was
really trying to supply was polymorphism.  C++ programs these days
apparently tend to use template-based generics rather than objects and
inheritance for that purpose.  

I've never programmed in Ada but I'm intrigued by these articles:

  http://adahome.com/Ammo/cpp2ada.html 
  http://www.adaic.org/whyada/ada-vs-c/cada_art.html

I have the impression that Ada has an undeservedly bad rap because of
its early implementations and its origins in military bureaucracy.  I'd
certainly consider it as an alternative to C or C++ if I had to write a
big program in a traditional procedural language.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 2 Aug, 05:04, Tomasz Rola rto...@ceti.pl wrote:

 And one should not forget about performance. C++ was for a long time
 behind C, and even now some parts (like iostreams) should be avoided in
 fast code.

For fast I/O one must use platform specific APIs, such as Windows' i/o
completion ports and memory mapping.

iostreams in C++ and stdio in C are ok for less demanding tasks.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 3 Aug, 00:27, Paul Rubin no.em...@nospam.invalid wrote:

 Certain folks in the functional-programming community consider OO to be
 a 1980's or 1990's approach that didn't work out, and that what it was
 really trying to supply was polymorphism.  C++ programs these days
 apparently tend to use template-based generics rather than objects and
 inheritance for that purpose.  

It avoids virtual function calls at the expense of unreable code and
errors that are nearly impossible to trace. It seems many thinks this
is a good idea because Microsoft did this with ATL and WTL. There are
also those who thinks template metaprogramming is a good idea. But who
uses a C++ compiler to dumb to unroll a for loop? In my experience,
trying to outsmart a modern compiler is almost always a bad idea.

 I have the impression that Ada has an undeservedly bad rap because of
 its early implementations and its origins in military bureaucracy.  

It is annyingly verbose, reminds me of Pascal (I hate the looks of
it), and is rumoured to produce slow bloatware. And don't forget
Ariane 5 ;)


 I'd
 certainly consider it as an alternative to C or C++ if I had to write a
 big program in a traditional procedural language.

I still prefer Fortran 95 :-)







-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why is python not written in C++ ?

2010-08-02 Thread Aahz
In article f9e652d6-3945-4c18-92f3-b85b994fe...@k8g2000prh.googlegroups.com,
Peter  peter.milli...@gmail.com wrote:
On Aug 3, 7:42=A0am, Mark Lawrence breamore...@yahoo.co.uk wrote:
 On 02/08/2010 00:08, candide wrote:

 I can't understand why any serious programmer mentions C++. As soon as I
 read it, I have to rush either to the kitchen to find a bowl to throw up
 in, or head for the toilet so I can talk to the great white telephone.

With you there Mark - IMO C++ is an abortion that should never have
seen the light of day. The idea of experimenting with creating an OO
language by extending C wasn't such a bad idea for a play thing (by
Stroustrop) but the fact that it somehow escaped from the Lab and
people picked it up and ran with it on a commercial basis is just
plain wrong!

http://www.netfunny.com/rhf/jokes/98/May/stroustrup.html
-- 
Aahz (a...@pythoncraft.com)   * http://www.pythoncraft.com/

Normal is what cuts off your sixth finger and your tail...  --Siobhan
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >