News for hackers. Stuff that matters.
Re:Using Rust at a Startup: A Cautionary Tale by satvikpendem on Tuesday November 22, 2022 @09:25PM (#33714374)
Your profile link doesn't work. Regarding `if err`, it's one thing to add it everywhere, it's another to forget and then have something break. If Go also checked for exhaustive error handling, I wouldn't mind it either.
Re:Using Rust at a Startup: A Cautionary Tale by Zagill on Tuesday November 22, 2022 @09:28PM (#33714404)
This is pretty trivial to accomplish with linters. Where I work your build will fail if you have unchecked err's hanging around, along with a lot of other sorts of issues. No, it's not built into the language by default or anything, but is that dealbreaking?
Re:Using Rust at a Startup: A Cautionary Tale by satvikpendem on Tuesday November 22, 2022 @09:31PM (#33714426)
It is dealbreaking. These days I gravitate more and more towards strongly statically typed languages over weakly dynamically typed ones, which I definitely used to use when younger. Fact is, linters are simply not the same as something built-in from the ground up. Trust me, I have written many thousands of lines of Python and Ruby, and even with linters, they don't hold a candle to even something like TypeScript in terms of type ergonomics and refactorability, not to mention even stronger languages like Haskell or OCaml.

Anecdotally this is the same argument many C++ devs make in regards to Rust safety guarantees. The difference is just...different.

Re:Using Rust at a Startup: A Cautionary Tale by pipe_connector on Tuesday November 22, 2022 @09:37PM (#33714463)
In general I agree with you, but Go's simple syntax means that there are extremely few (if any? I've never run into one) edge cases with checking that an error was at least considered. The guarantees are the same as what you get with e.g. Rust. The only difference is that you have to run a third party's code, which I don't like, either.
Re:Using Rust at a Startup: A Cautionary Tale by satvikpendem on Wednesday November 23, 2022 @12:45PM (#33722257)
> The guarantees are the same as what you get with e.g. Rust.

I'm not sure how they could be, given that Rust checks exhaustively and Go doesn't. If one programmer messes up, then that's it, an unhandled exception might occur in the future. I would rather rely on the computer telling me when it should be handled over humans.

Re:Using Rust at a Startup: A Cautionary Tale by kika on Thursday November 24, 2022 @08:57AM (#33731316)
And the worst human to tell you that is an SRE
Re:Using Rust at a Startup: A Cautionary Tale by Zagill on Tuesday November 22, 2022 @09:37PM (#33714469)
Well for one, Go is not a weakly, dynamically typed language, and this also isn't an issue of type checking at all.
Re:Using Rust at a Startup: A Cautionary Tale by satvikpendem on Tuesday November 22, 2022 @09:42PM (#33714497)
Sure, I did not mean Go specifically when I said that, just stating how when I used linters in other such languages, it was not comprehensive enough to replace a language with types and other niceties built-in.

I also don't use much Go because it lacks good algebraic data type support, honestly can't imagine going back to a language that doesn't have them as I like to define all my business logic in types and then build the actual application from there. Go simply doesn't have that capability.

Re:Using Rust at a Startup: A Cautionary Tale by Zagill on Tuesday November 22, 2022 @09:55PM (#33714585)
I'm not familiar with algebraic data types, what's missing from Go that makes that impossible? Sounds about like defining structs/other custom types before writing any method bodies, which is what I'd typically do in a Go project.
Re:Using Rust at a Startup: A Cautionary Tale by satvikpendem on Tuesday November 22, 2022 @09:59PM (#33714607)
> what's missing from Go that makes that impossible?

The language maintainers don't want to add it: https://github.com/golang/go/issues/19412

Re:Using Rust at a Startup: A Cautionary Tale by pipe_connector on Tuesday November 22, 2022 @09:31PM (#33714430)
https://github.com/kisielk/errcheck

Every Go project I've worked on has used this linter. I think it should be builtin, but it's very easy to incorporate.

Re:Using Rust at a Startup: A Cautionary Tale by shepherdjerred on Wednesday November 23, 2022 @01:31AM (#33715916)
> but it's very easy to incorporate.

As someone who is adding this to a Go project with hundreds of unchecked errors, I disagree.

Re:Using Rust at a Startup: A Cautionary Tale by styluss on Wednesday November 23, 2022 @09:50AM (#33719775)
What kind of error does it check?
Re:Using Rust at a Startup: A Cautionary Tale by panachaud on Friday November 25, 2022 @05:26PM (#33747496)
It looks for code where the err != nil hasn’t been handled