News for hackers. Stuff that matters.
Re:Rust is a hard way to make a web API by nine_k on Friday January 15, 2021 @10:38PM (#25799808)
Go still has a few annoyances: error handling and casting things to/from interface{} are the most painful of them.

Certainly, it's still ways better than C. But the resulting boilerplate and copy-paste programming ought to be a source of errors.

(I'm happy to see the generics proposal coming closer and closer to a future feature.)

Re:Rust is a hard way to make a web API by Animats on Saturday January 16, 2021 @02:54AM (#25800833)
Error handling is not that great in either Go or Rust. It wasn't that great in Python, either, until Python standardized its exception hierarchy. That seems to be the key - get everything to use the same exception format, especially the libraries. How the error values are passed around is less important.
Re:Rust is a hard way to make a web API by lenkite on Monday January 18, 2021 @01:45AM (#25818939)
1 always need to spend 30 mins educating everyone on the "nil interface" on Go. Go lang is fine for small network services that do just one job but it doesn't scale up as an app programming language for large teams. It has far too many edge cases and gotchas. Also, loads and loads of boilerplate - making Java look elegant.
Re:Rust is a hard way to make a web API by nprateem on Saturday January 16, 2021 @12:05AM (#25800201)
Error handling is such a train wreck. Manually returning an error in 2021? What were they smoking?
Re:Rust is a hard way to make a web API by jamiesonbecker on Saturday January 16, 2021 @12:44AM (#25800373)
Explicit is better than implicit, and you can't get much more explicit than that.
Re:Rust is a hard way to make a web API by erik_seaberg on Saturday January 16, 2021 @01:58AM (#25800634)
Nobody wants to write or read

  PUSH EBP
  MOV EBP, ESP
  SUB ESP, 12
a thousand times a day. The best you can do is avoid screwing it up. So when you write a function in any language since 1960 it just happens. Stopping a function halfway and bubbling an error up the stack should also just happen.
Re:Rust is a hard way to make a web API by _peeley on Saturday January 16, 2021 @03:18AM (#25800905)
I agree, although there are IMO more optimal and explicit ways to handle errors - Rust and Haskell come to mind. When dealing with a Result/Either/Maybe or some other functor, you have to acknowledge the context of the value, i.e. that the value could possibly be an error. This way the error handling is baked into the type system in a way that's hard to replicate in languages that just return error codes or exceptions.
Re:Rust is a hard way to make a web API by antonvs on Saturday January 16, 2021 @05:13AM (#25801329)
> Explicit is better than implicit

Which just demonstrates why slogans are not a good substitute for thought.

They're good for programming a community though.

Re:Rust is a hard way to make a web API by nprateem on Friday January 22, 2021 @02:53AM (#25869458)
If you believe that I hope you only write in assembler
Re:Rust is a hard way to make a web API by it on Saturday January 16, 2021 @12:17AM (#25800250)
It's actually really nice to have the good quality error messages that Go encourages when something goes wrong.
Re:Rust is a hard way to make a web API by nprateem on Saturday January 16, 2021 @02:03AM (#25800657)
If you remember to write them and propagate them...