mirror of
https://github.com/uselessd/alcove.git
synced 2026-04-16 09:45:15 +00:00
Cleanup of the setopt function:
* use an unsigned integer for holding the arg
* add a typespec for setopt/3,4.
* change the return value to true/false
Previously, if an unknown option was passed to setopt, the process would
crash with badarg. Reserve badarg for wrong types and return a value to
the caller.
inet:getopts/setopts take a list of options. If any of the options are
invalid, {error,einval} is returned to the caller. The valid options are
not changed.
alcove:getopt/2,3 returns an unsigned integer or false if the option is
not supported.
alcove:getopt,setopt will (should?) never fail if a valid argument is
used. So replying with an ok tuple, like the inet functions, is not necessary.
So setopt could more exactly return 'ok' and 'invalid' or 'not_found'
(diverging from getopt) or it could follow getopt and return ok/false,
which, to be more consistent, should be a boolean.