Python handles globals badly.

Mario Figueiredo marfig at gmx.com
Wed Sep 9 21:57:12 CEST 2015


On 09-09-2015 18:55, Steven D'Aprano wrote:
> On Wed, 9 Sep 2015 11:09 am, Mario Figueiredo wrote:
> 
>> You know, it is a pointless exercise to try and downplay programming
>> languages (any programming language) that has proven its worth by being
>> generally adopted by the programming community. Adoption is the sign of
>> a respected and well designed language.
> 
> Counter-examples: PHP and C.
> 
> Adoption of programming languages is driven by many things, technical
> excellence and careful design are not even in the top 10. Most of them are
> social in nature, particularly "what is everyone else using?". Network
> effects dominate: you could design the perfect language, but if nobody else
> uses it, nobody will use it.

You paint a dim picture of the computer science ecosystem. You almost
make it look like we are a bunch of fashionists. There is some truth to
what you are saying, but not to the level you are implying. "Technical
excellence not being on the top 10" is just a blanket statement that
does not address the constant search for better programming languages.

The fact is that you, I and a large representative number of software
engineers are always on the constant lookout for better designed
languages. And it's people like us that eventually ensure the success of
a programming language based on its merits. It's the software
engineering "society" that eventually promotes a programming language
out of obscurity and into popular use. And this can only happen if that
language holds enough merits. We may have been experiencing a rise in
programming languages protected by commercial interests, but so far they
still obey this simple truth.

That speech that languages are popularity contests is just a superficial
view of the whole of the industry and frankly very much untrue.

> Sometimes a language will actually gain a kind of technical excellence
> despite some really shitty design decisions -- but usually at great cost
> elsewhere. C is a good example of that. Due to lousy decisions made by the
> designers of C, it is a language really well suited for writing fast,
> incorrect code.

Right. There we go. Another, C is a badly designed language...
If I had a penny for every time I heard this, I could then wish for a
penny for every other program or computer language that was designed in
C. I would be twice as rich.

Almost all of the modern programming edifice sits on top of C on one way
or another. Our operating systems, many of our most mission critical
system, even many of our high level programming languages, including the
one represented on these forums. But somehow, there is always someone
trying to sell that C is a lousy designed programming language. At this
point in history, I couldn't blame C anymore. If it is such a lousy job,
then the real problem must be with the people that kept on truckin' it
around. That includes the whole of the computer science industry.

And that just doesn't make sense. Your programming language based on
lousy decisions, proved instead that those those lousy decisions around
lack of security are necessary when you need to create a systems
programming language that can eventually carry on its shoulders the
weight of an entire industry.

Maybe Rust will finally be able to prove that you can do better. That it
is actually possible to create a close-to-the-metal programming language
with security in mind and as performant as C. But if it does succeed
(and I'd like for it to succeed, make no mistake), it took us over 40
years to actually come up with something.


> In fairness to the C creators, I'm sure that nobody back in the early
> seventies imagined that malware and security vulnerabilities would be as
> widespread as they have become.

Of course they did. The Design of C states this on several occasions,
while The C Programming Language is full of mentions to the security
concerns in some of the programming language semantics. Meanwhile the
patterns and best practices for secure C code are known for decades,
well before the widespread use of computers and the internet itself.

> I believe that the computing industry may never recover from the harm done
> to it by the widespread use of C.

Yes. It's been a terrible 4 decades of technological innovation.


More information about the Python-list mailing list