8 ms·
Why not Go? Checks the boxes of "performant" and "safe" while remaining developer friendly compared to Rust
by vitalus 10y ago
Why not Go? Checks the boxes of "performant" and "safe" while remaining developer friendly compared to Rust
- ben_jones 10y agoOh connection pooling is handled automatically by the standard library ...jk not really, it leaks sometimes ... and ...down ...goes ...my ...production database. 2 weeks ago.
- veegee 10y agoI'm not a fan of Go, but the connection pooling in the standard library doesn't leak. You're just not closing the Rows object if you encounter an error. It automatically closes if you fully iterate through it. But if you stop part way, you have to manually close it or the connection will not be returned to the pool.
- ben_jones 10y agoYeah I don't have the code or docs in front of me but I think it was calling db.Query().Scan(&thing) and forgetting to close the row returned by .Query(). I was also using some edgier parts of the sql package without fully understanding a lot it, so I exposed myself quite a bit. Go is a small language but it's a language with roots in C that many people (myself included) don't understand that well. It's deceptively easy, kind of like picking up Elixir because Ruby without understanding Erlang. Lots of paper cuts.
- lmm 10y agoLack of generics is extremely developer hostile.
- shrugger 10y agoGender-shaming male developers is hostile, but Mozilla never cared about that, did they? Or how about that time Eich donated thousands of dollars to try and prevent homosexual marriages? Rust might be memory-safe, but it's culture-toxic.
- bluejekyll 10y agoYou can just as easily ask, why not any other language, for the exact same reason. But since you asked about Go, here are the 3 reasons that I would not pick Go: 1) no generics means less code reuse, which mean more testing of more code (potential runtime issues) 2) allowance of Null, means potential NPE/seg-faults (runtime issue) 3) non-type safe, inconsistent error handling (another runtime issue) Go is a fine language, like many others, but it's not the same as Rust, and doesn't offer the same features (like no runtime/GC), which means it's not as flexible in its usage. But, I will grant you that Go is "easier" to write code in. Anyway, there will be and are many great programs written in Go, as there have been in C, C++, Java, Perl, Python, Ruby, Erlang, Haskell, Ocaml, Ruby, JS, etc. To each there own. Mine is Rust today, was Java before that, C++ before that, C before that, and Basic before that.
- vitalus 10y agoSure, it just felt like a more natural fit than other languages given the criteria which is why I called it out specifically Thanks for your mention of additional runtime safety, it isn't something I had considered
- pcwalton 10y agoThe article helpfully answers that question for you. It's entirely about features unique to Rust.
- vitalus 10y agoI actually saw very few unique features of Rust mentioned in the article which is why I was looking to contrast it at a high level to another language which met the criteria the author laid out while avoiding a mentioned drawback...I would hardly consider "it compiles to native" and "measured and thoughtful standard library" to be features unique to the language, though no doubt important!
- pcwalton 10y agoThe sophisticated type checker, the borrow checker, and the LLVM backend were all cited in the article and are all things Rust has that Go doesn't.