Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coerce booleans and integers to other types #116

Merged
merged 1 commit into from
Mar 27, 2023

Conversation

joneshf
Copy link
Owner

@joneshf joneshf commented Mar 27, 2023

Since UCI doesn't really have types anywhere, we have to be very careful
about how we parse things. If an option has a value of "1", this could
be a boolean, integer, or string; depending on the config it's a part
of. Frankly, this is an incredibly bad representation. And it feels like
the sort of thing where a language is not designed, but extended over
years without taking a step back and removing these awkward cases.

We add support for coercing the different types that we can at least
identify as possibly being something else. We almost surely are missing
some cases here. But, we'll deal with that when they arise. For now, we
at least can coerce some booleans and integers to other types.
Hopefully, this catches most of the cases.

Since UCI doesn't really have types anywhere, we have to be very careful
about how we parse things. If an option has a value of `"1"`, this could
be a boolean, integer, or string; depending on the config it's a part
of. Frankly, this is an incredibly bad representation. And it feels like
the sort of thing where a language is not designed, but extended over
years without taking a step back and removing these awkward cases.

We add support for coercing the different types that we can at least
identify as possibly being something else. We almost surely are missing
some cases here. But, we'll deal with that when they arise. For now, we
at least can coerce some booleans and integers to other types.
Hopefully, this catches most of the cases.
@joneshf joneshf merged commit dd654bc into main Mar 27, 2023
@joneshf joneshf deleted the joneshf/coerce-booleans-and-integers-to-other-types branch March 27, 2023 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant