-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
breaking changeChanges that are expected to break interfacesChanges that are expected to break interfacesenhancementNew feature or requestNew feature or request
Description
Context
Inconsistent API
Main behavior is somewhat inconsistent:
@callback get(name :: atom()) :: struct() | nil
@callback set(struct :: struct()) :: {:ok, struct()}
@callback delete!(name :: atom()) :: {:ok, any()}
@callback enabled?(name :: atom()) :: boolean()
@callback enable(name :: atom()) :: {:ok, struct()}
@callback disable(name :: atom()) :: {:ok, struct()}
getshould probably return{:ok, struct()}to matchsetreturn values- It's quite ok to return just a boolean for
enabled?, but we may not need to return anything other than a plain:okforenableanddisable delete!should probably drop its exclamation mark. I don't remember why I added it there and not onset(IIRC, I think I dropped it forset)- Yup, looks like
delete!escaped the slashing: 19d6f6f
- Yup, looks like
- Error specs should probably be added
Code quality
I think code quality could be greatly improved, eg. by:
- Using
withwhen relevant - Dropping nested cases
- Separating behavior with macro definition
- Making sure errors are correctly checked (
|> Type.load()looks sus).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
breaking changeChanges that are expected to break interfacesChanges that are expected to break interfacesenhancementNew feature or requestNew feature or request