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

feat: support searching where value is unknown #75

Merged
merged 3 commits into from
Nov 6, 2023
Merged

Conversation

jamesdabbs
Copy link
Member

@jamesdabbs jamesdabbs commented Nov 6, 2023

Adds minimal support for 3-valued logic. Formula types support arbitrarily many extended types with the default (X = never) type, but parsing and evaluating is currently only well-defined for value types that extend (boolean | null).

Note that we're using null to represent unknown here in part so that helpers like

atom(property, value = true)

can distinguish between being called with an unknown and being called without providing the default argument.

Fixes #70


🔬 Testing Notes

Visiting this search url shows

Screenshot 2023-11-06 at 9 09 29 AM

Adds minimal support for 3-valued logic. Formula types support
arbitrarily many extended types with the default (X = never) type,
but parsing and evaluating is currently only well-defined for value
types that extend (boolean | null).

Note that we're using null to represent unknown here in part so that
helpers like

    atom(property, value = true)

can distinguish between being called with an unknown and being called
without providing the default argument.

Fixes #70
@jamesdabbs jamesdabbs self-assigned this Nov 6, 2023
Copy link

cloudflare-workers-and-pages bot commented Nov 6, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5fa1da5
Status: ✅  Deploy successful!
Preview URL: https://bc4d01fd.topology.pages.dev
Branch Preview URL: https://3-valued-logic.topology.pages.dev

View logs

Comment on lines +34 to +37
export interface Atom<P, X = never> {
kind: 'atom'
property: P
value: boolean
value: boolean | X
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

X represents the set of extended (non-boolean) allowed values.

@jamesdabbs jamesdabbs marked this pull request as ready for review November 6, 2023 16:11
@jamesdabbs jamesdabbs merged commit 8a4bd46 into main Nov 6, 2023
2 checks passed
@jamesdabbs jamesdabbs deleted the 3-valued-logic branch November 6, 2023 16:16
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.

? indicator for search function
1 participant