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

Add Bool type in stdlib #213

Open
katat opened this issue Oct 24, 2024 · 1 comment
Open

Add Bool type in stdlib #213

katat opened this issue Oct 24, 2024 · 1 comment
Labels

Comments

@katat
Copy link
Collaborator

katat commented Oct 24, 2024

When creating a variable to represent a bool value, we have to make sure it is constrained as a boolean.

For example:

assert_eq(bit * (bit - 1), 0); // where bit is a field variable

To make the code more expressive by itself, we can add a bool type in stdlib to constrain the field variable as a boolean value.

For example:

use std::bits;

let bool = bits::Bool::new(1); // the new method should also constrain the argument value.

This Bool type can be an addition to the existing std::bits stdlib module.

Related: #201 (comment)

@katat katat mentioned this issue Oct 24, 2024
2 tasks
@katat katat changed the title Support Bool::new(field_value) Add builtin struct for Bool type Nov 8, 2024
@katat katat changed the title Add builtin struct for Bool type Add Bool type in stdlib Nov 8, 2024
@katat katat added the easy label Nov 8, 2024
@bufferhe4d
Copy link
Contributor

To make it distinguishable from TyKind::Bool (mentioned here as well: #201 (comment) ). Would it make sense to have bits::Bit::new(1); instead of bits::Bool::new(1);?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants