6 ms·
Ruby and Python are notorious for being difficult to read because of all the foot guns in place. Monkey patching, duck typing, metaprogramming... and that's not
by solosoyokaze 6y ago
Ruby and Python are notorious for being difficult to read because of all the foot guns in place. Monkey patching, duck typing, metaprogramming... and that's not even talking about structural limitations like the GIL.
Go is definitely more verbose and less "fun" to write, but it's 10X easier to reason what's going on in a large application.
Of course, it's also the correct kind of solution for some types of problems. If you need a compiled language (many do), the competition to Go isn't Ruby and Python, it's C++ and Rust.
- cb321 6y agoOr Nim or Zig or ... Actually, I feel like Zig may be most in the compiled-but-keep-it-simple-like-C headspace as Go. I don't know either Go or Zig super well. From what I do know, Zig seems not quite as stubborn as Go about forcing code to be "simple to reason about" (which is also subjective, though maybe less so than "easy to do things").
- dnautics 6y agoI would say Zig is interesting in that "safe things are easy and pretty", "unsafe things are difficult and ugly", thus drawing eyes to the code that needs it. It's four lines of nasty looking code for me to convert a slice of bytes to a slice of (f64/f32/i32)... Which the compiler no-ops. This is dangerous because the alignment and byte count must be correct.
- solosoyokaze 6y agoI would say both of those are interesting languages, but lack the amazing standard lib of Go and definitely the tooling and industry support. Personally, I find Swift to be a really great language, but can't deal with the Apple eco-system, XCode, raw Linux support...
- cb321 6y agoTotally agree Re: Swift drawbacks. Nim's stdlib is actually quite large (like 300 modules). I am sure there are things in Go's that are not in Nim's (like Go's `big`), but I am equally sure there are things in Nim's that are not in Go's (like Nim's `critbits`, `pegs`, etc). I doubt there is much in Go's stdlib not available in Nim's nimble package system, but OTOH, I am also sure the Go ecosystem is far more vast. I just didn't want people left with the impression Nim's stdlib is as small as Zig's which it is definitely not. Nim has web server/client things and ftp/smtp clients, json and SQL parsers, etc.
- jacobr1 6y ago> If you need a compiled language I would wager jvm/clr are probably the main competition for Go at least for product/tech companies and enterprise IT.
- solosoyokaze 6y agoDefinitely for server-side software, but not for binaries that need to be distributed to end users.
- eeZah7Ux 6y agoPython is widely considered to be very expressive and very readable. You can write unreadable code in virtually any language but that's besides the point.
- solosoyokaze 6y agoConsidered "very readable" by whom? It's pretty well accepted that dynamic/weakly typed languages are more difficult to deal with at scale.
- prionassembly 6y agoPython is dynamically but strongly typed. “2+True” is a type error; once something has a type, it has a type. There’s no WAT.
- solosoyokaze 6y agoVariables can change type though. This is working python code: x = 1 y = 2 print(x + y) x = "no " y = "types" print(x + y) Whereas this will not even compile in Go: x := 1 y := 2 x = "no" y = "types"
- anaerobicover 6y agoThat's the difference between static and dynamic typing, not the difference between weak and strong. The values cannot be used as if they were another type.
- solosoyokaze 6y agoSo what's the type signature of `print()` then? I do think my example code demonstrates why Go is easier to reason at scale than Python. Python is conflating assignment and type declaration. Go has = and :=, so it's crystal clear what's going on.
- Can_Not 6y ago> the competition to Go isn't Ruby and Python, it's C++ and Rust. Crystal is a pretty solid alternative to golang.
- itake 6y agoCompanies use golang for web services, which directly competes with Ruby and Python.
- Cthulhu_ 6y agoAnd Java, which (I feel like) is used for bigger, long-term projects.