[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: Why is C so popular?



On Thu, 2003-08-28 at 09:10, Anders Arnholm wrote:
> On Thu, Aug 28, 2003 at 06:46:09AM -0500, Ron Johnson wrote:
> > Lets take my MUA, Evolution, for example.  It's not processor 
> > intensive.  Why couldn't it be written in Python?  
> 
> One of the main reasons is that Python leaves a loot of the resolving to
> runtime, that means that the code actually has to be run before you can
> see tha actuall typo found at compile time in languanges as C. 

This is such a fallacy. It's very easy to make code that compiles but
crashes. Compilers just compile code, they do not give it a magic "This
program is well written" certificate. Use pychecker, be happy. or better
yet, test your code.

> > So many potential bugs related to pointers and null-terminated 
> > strings would be eliminated.  The SLOC count would be lowered, and
> 
> Yes that kind of problem would be removed, but Python code has other
> parts that may as well fail. Many being simples problems of types that
> simply isn't resolved untill runtime and as all code isn't run all the
> time it may burry it self long down and hidden. I think that is bad for
> large projects.

how is that different from some C code casting inappropriately deep in
the bowels of your app? In python, you at least get a useful exception,
in C you just get a nasty segfault and fun with the debugger.

I strongly suggest you take a look at this interview with GvR:
http://www.artima.com/intv/strongweak.html

here's a snippet: "That attitude sounds like the classic thing I've
always heard from strong-typing proponents. The one thing that troubles
me is that all the focus is on the strong typing, as if once your
program is type correct, it has no bugs left. Strong typing catches many
bugs, but it also makes you focus too much on getting the types right
and not enough on getting the rest of the program correct."

-Mark



Reply to: