You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Functions like operations::install take parameters that are often instantiated using a default value.
Perhaps we can use builders instead. This could make the API more flexible, allowing us to add optional arguments without it being a breaking change.
For example, operations::install could look like this:
In this example, all arguments could be optional (config has a default, package_db can be instantiated from a default config, packages can be empty...)
Functions like
operations::install
take parameters that are often instantiated using a default value.Perhaps we can use builders instead. This could make the API more flexible, allowing us to add optional arguments without it being a breaking change.
For example,
operations::install
could look like this:Bonus: Since there are non-optional parameters, we could implement type-safe curried builders, where the types would look like this:
Or, not as pretty, but simpler, with less boilerplate:
In this example, all arguments could be optional (
config
has a default,package_db
can be instantiated from a default config,packages
can be empty...)@vhyrro, what are your thoughts?
The text was updated successfully, but these errors were encountered: