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

code: Replace Option<Value> with bespoke type to better express intent #114

Merged
merged 1 commit into from
Dec 8, 2023

Conversation

romac
Copy link
Member

@romac romac commented Dec 8, 2023

Using None to denote nil is sometimes confusing as it may be interpreted as the absence of result or as short-circuit rather than an explicit nil value.

Hence, this PR introduces the NilOrVal<Value> enum, isomorphic to Option<Value> to better express the intent.

Where we were previously using None to denote nil, this is now expressed as NilOrVal::Nil, and where were using Some(Value) to denote the presence of a value to decide or vote on, this is now expressed as NilOrVal::Val(Value).

@romac romac force-pushed the romac/value-or-nil branch from 0c0d786 to e13ddc3 Compare December 8, 2023 11:22
@romac romac requested a review from ancazamfir December 8, 2023 11:22
@romac romac marked this pull request as ready for review December 8, 2023 11:22
@romac romac changed the title code: Replace Option<Value> with NilOrVal<Value> to better express intent code: Replace Option<Value> with bespoke type to better express intent Dec 8, 2023
@romac romac merged commit b78ac1a into main Dec 8, 2023
6 checks passed
@romac romac deleted the romac/value-or-nil branch December 8, 2023 14:41
romac added a commit that referenced this pull request Dec 8, 2023
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