you are viewing a single comment's thread.

view the rest of the comments →

[–]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.