News for hackers. Stuff that matters.
Re:My least favorite Rust type by _28jh on Monday September 21, 2020 @10:36PM (#24550337)
You're missing the point. Here's a good article that talks about the problems of having neither overloading nor default parameters, but in Go.[1] The problem is made significantly worse in Rust when all struct fields need to be initialized and there are no varargs. I really see no solution to the "stable API with more options" problem in Rust, aside from a builder pattern, which I really hate.

1: https://dave.cheney.net/2014/10/17/functional-options-for-fr...

Re:My least favorite Rust type by estebank on Tuesday September 22, 2020 @12:08AM (#24550736)
Why do you have the builder pattern (other than the verbosity of declaring them)?

I normally just leverage a couple of features: Derive(default) to have an "empty" initialized value and the struct field filling syntax

  let x = Foo { field_i_care_about, ..Default::default() };
Re:My least favorite Rust type by svnpenn on Monday September 21, 2020 @11:45PM (#24550629)
In Go, you can use an interface to implement private struct fields. Then you can make a "New" function to implement default values as needed. I made a post about this last month:

https://stackoverflow.com/a/63552596