Closed TanklesXL closed 1 year ago
Option
for the default flag value, this way if a flag is required but not provided an error will be returnedone open question, is it better to have the getters return an Error
if the flag has no default and is requested, or should they just return an Option
and let the caller decide what that should mean
one open question, is it better to have the getters return an
Error
if the flag has no default and is requested, or should they just return anOption
and let the caller decide what that should mean
Nice changes! I like the change where now default is Optional, so I don't have to handle "special case" of default value later in code! According your question, now it feels like there are kinda two scopes of Optional
and they are overlapping, which might make things a bit confusing. The first scope of optional just allows to provide a default value, but only if you want to. I think it's very good and straightforward. In this case Error
is needed to indicate - there is no provided value and no default to fallback. The second scope is not about default values but about optional flags themselves (if I understood correctly). So the second scope might give a possibility to not have a flag at all. In this case output type of flag parser is Optional. Not sure it's easy to parametrize output type this way, don't have a lot of experience with language yet.
11 : this change includes the additions of a
Constraint
type for adding flag value checks to glint, this is consistent with keeping glint itself non-generic while adding a nicely extensible validation functionality