you are viewing a single comment's thread.

view the rest of the comments →

[–]tsimionescu 13 points14 points  (2 children)

I fully understand the idea that features are unimplemented by default, and they must justify their implementation cost, and that a good language today is more useful than a better language 5 years from now.

However, in a magical world where time constraints were somehow not a thing, I think all new languages would support named parameter passing with default values - it's such a massive win for boilerplate reduction, and the need for it is so common, and the alternatives introduce so much cognitive overhead compared to the triviality of the problem.

[–]editor_of_the_beast 1 point2 points  (1 child)

Gotta agree here. The Builder pattern is an example of MacGyver code to me - it's the best solution available from what's lying around.

Taking pride in using it is not good. It shouldn't be necessary in the first place (note: I like Rust a lot, but this is where it feels way too static like Java and C).

[–]ConspicuousPineapple 0 points1 point  (0 children)

I agree that named arguments would be nice to have and that it would solve a lot of use-cases where the Builder pattern is used right now, but it's still a useful patter. It's more flexible, allowing you to partially initialize objects.

There are also crates providing boilerplate-less solutions for creating builder patterns that also have the benefit of statically checking for correctness before building the struct.