Hacker News new | ask | show | jobs
by Narann 1700 days ago
> Are there better ways

It's a question of taste, but the builder pattern can be considered a “better way”, because of how clunky the use of Default can be.

You would prefer an API with easier to read, documented builders than the ..Default::default() call.

1 comments

What I dislike about the builder pattern is that it treats input not as one 'blob' of data and thus makes simple things more complicated.
I have the same feeling. I would love to know if a builder object can be zero cost and if it could actually write assembly code the same way as if we would have passed those arguments manually.