Hacker News new | ask | show | jobs
by 8organicbits 1489 days ago
> #5 Fast compile time... which is an advantage over Python how exactly?

Compiled code can have fewer runtime errors, that's a big win. I read this as golang is better than python because it's compiled and golang is better than Java and C++ because the compiler is fast.

4 comments

The advantage then is "the type system", not "fast compile time".

And as far as type systems go, Go is one of the worst in mainstream usage.

Just curious, which languages have better type systems?
TypeScript, Kotlin, Scala, Haskell, Rust, Swift, modern Java, C#, F#, OCaml, Reason, Elm, PureScript,... it's a long list.

I'd also count Python with MyPy, but having a mostly untyped ecosystem means you can't take much advantage of it.

It's easier to list which ones don't at this point. The Go team ignored the last 50 years of improvements in type systems.
All of them? Minus the dynamic/weaks, such as original javascript.
Rust, Haskell, OCaml, and many others.

Golang's typing system is fairly half-done.

But still better than Python's.
Despite its warts, Python's type system is at least comparable to Go, and better in several areas. The type inference works really well much of the time without any assistance, you can use tools like pyre to generate types for untyped code, as well as tools for discerning types through running the application.

Heck, you can even use HKTs in Python if you are willing to install a plugin/library.

https://returns.readthedocs.io/en/latest/pages/hkt.html

I can understand the point - compiling will do the same checks a type hint checker such as MyPy will do and it's a bit faster. I have that in my pre-push hooks, but a lot of people isn't used to the 90's when a compile could take minutes and demand a far less relaxed development pace.
I have a hard time believing Go compiler being faster than Java’s. Like, none of them do barely any optimizations, but Go still has to do a bit more.
Javac is extremely fast. It doesn’t have to do any optimizations.