3 ms·
>> Made by really famous veteran language designers > Yeah that’s a positive No, that's also a negative. C is close to assembly and produces fast code but it's
by timbit42 4y ago
>> Made by really famous veteran language designers
> Yeah that’s a positive
No, that's also a negative. C is close to assembly and produces fast code but it's weakly typed and very unsafe. Pascal was the strongly typed and safe option but people went for C because speed was considered more important than safety back when processors were slow.
In today's online world, we've realized safety is more important than speed. We write web apps in slower interpreted languages and Rust is a response to unsafe code that can be hacked like a hot knife through butter. I consider it a move in the right direction.
So I don't consider Go being made by really famous veteran language designers to be a plus because they produced a poor language that only won out because it neglected safety in a quest for speed. That wasn't as bad when computers weren't online, but it still allowed programmers to make errors that caused code to crash. Today it's become a critical issue.
Interestingly, Go is more like Pascal, Modula-2 and Oberon than like C, except in syntax. With Go, the creators of C have admitted Niklaus Wirth was right.
- CraigJPerry 4y ago>> but it's weakly typed and very unsafe Oh here we go :-) and yet the world spins on C kernels and lands jumbo jets in C autopilots and regulates heartbeats with C pacemakers and, and, and … It seems there’s more nuance to this than just “strong types good”. >> people went for C because speed was considered more important than safety But for the past 10-27 years people have the choice to use a fast and safe language (java, c#, go) and they do, in very large numbers. For the past 10 years (-ish) they’ve had the choice to use rust too - but they don’t. Rust has a popularity comparable to clojure or erlang.
- anthk 4y ago> fast and safe language (java, C#...) No, no even close. Java and C# crawled on a Pentium III-IV even with SSE2 compared to C and C++. If you said Ocaml...
- CraigJPerry 4y agoI started using java at 1.4, i remember Sun shouting to anyone who would listen that HotSpot could beat the gcc of the time on some 32bit integer benchmarks. IIRC it wasn't a million miles off the pace for floating point operations either.
- jfim 4y ago> Oh here we go :-) and yet the world spins on C kernels and lands jumbo jets in C autopilots and regulates heartbeats with C pacemakers and, and, and … Keep in mind that many of those things are written in a subset of the C programming language, such as MISRA C.
- CraigJPerry 4y agoAbsolutely, just as there are many ways to achieve C speed in languages like Java for particular sections of code by applying non-idiomatic optimisations, there are also many ways to improve safety beyond just types. Even things like the borrow checker has decent alternatives (tsan, msan etc.) that can be used in existing language stacks. MISRA as you point out is another useful tool in the toolbox.
- anthk 4y agoPascal in DOS was as fast as C if no more.
- timbit42 4y agoTurbo Pascal wasn't entirely compliant to the Pascal spec either.
- pjmlp 4y agoProduction class Pascal compilers weren't, thus the Kernigham meme about Pascal misses the point that outside UNIX and a few other systems, the Pascal dialect people were using was as capable. Likewise outside UNIX, the C compilers that were starting to appear were just as fragemented, supporting only subsets of K&R C.
- rob74 4y agoThe "Pascal-like" elements are the contribution of Robert Griesemer (https://en.wikipedia.org/wiki/Robert_Griesemer https://en.wikipedia.org/wiki/Robert_Griesemer), who studied in Zurich and is also a co-creator of Go. The syntax has the curly braces and other C-family elements to appear more familiar (plus nobody really wants to write "begin ... end" all the time), but the declaration syntax is also Pascal-style ("x int" instead of "int x"). What reminded me most of Pascal when I first saw it was the ":=", but it has a different meaning in Go than in Pascal. ...and "really famous veteran language designers" wouldn't become famous veterans if they wouldn't learn something along the way.
- morelisp 4y agoYou've completely mixed up two different senses of "unsafe", the one where the language is prone to idioms that cause fatal errors (which is also true of all those slower interpreted languages), and the one where a mistake means the program can do literally anything (which is not true of Go). "Unsafe" in most discussions today refers exclusively to the latter.