3 ms·
It's good to see an API critique. I don't think enough attention is paid to their design. The problematic design is something I see fairly frequently from peop
by noelwelsh 3y ago
It's good to see an API critique. I don't think enough attention is paid to their design.
The problematic design is something I see fairly frequently from people who aren't familiar with sum types, aka modelling data that has logical ors. It's very common in the Javascript world as well, for example, and in Go it's baked in with functions returning four possible values (success and error, success and nil, nil and error, nil and nil) when only two are valid.
A better design uses a combinator libraries / builders / fluent API. These are little finite state machines and the best libraries make it so invalid transitions cannot be compiled (which requires a type system).