Closed Stebalien closed 7 years ago
Currently boolean flags when accessed through the typesafe getter always return a value, even if they're not defined in the database.
So Value::Boolean(false)
cannot be present in the database, but it's used by the API.
Personally I prefer it this way, what do you think?
If we're talking about the same thing, the typesafe getter doesn't return Value::Boolean
, it returns CapabilityType(true|false)
. It's not really an issue, I just prefer not to have unused variants :).
@Stebalien ah wait, you're right, it's an artifact from the first iteration of the type-safe API.
On the other hand there can be false boolean flags, but they're kind of an implementation detail since they're just used for offsets within the name table.
So it's either removing the value within the variant, or adding the false booleans.
Although the latter ends up being more verbose to check if a boolean capability is on, since you'd have to check for None
and Some(Value::Boolean(false))
.
I guess I'll go with the former.
There's now Value::True
instead of Value::Boolean(bool)
.
Unless I'm mistaken, it can't. Any reason to not just change this to
Value::Flag
orValue::True
?