cfallin opened issue #3573:
ISLE's prototype compiler was built with the simplifying assumption that all constants are integers. "Symbolic constants" (imported opaque values) like
$MYVALUEwere added later. It's possible to defineboolas a primitive type, but the syntax for bool constants,#tand#f, results in generated code that uses integer values1and0because... everything is (was) an integer. This is clearly suboptimal! In #3572 @alexcrichton used the clever workaround of$false, leveraging the support for arbitrary passthrough of constant names to actually get afalsein the code.We should (i) add a
ConstBoolalongsideConstIntin the IR (PatternInstandExprInst), and (ii) codegen these properly as Rust bool types. We might also consider at some point making our "primitive" type hierarchy a bit richer and distinguishing ints and bools, but that's lower-priority.
cfallin labeled issue #3573:
ISLE's prototype compiler was built with the simplifying assumption that all constants are integers. "Symbolic constants" (imported opaque values) like
$MYVALUEwere added later. It's possible to defineboolas a primitive type, but the syntax for bool constants,#tand#f, results in generated code that uses integer values1and0because... everything is (was) an integer. This is clearly suboptimal! In #3572 @alexcrichton used the clever workaround of$false, leveraging the support for arbitrary passthrough of constant names to actually get afalsein the code.We should (i) add a
ConstBoolalongsideConstIntin the IR (PatternInstandExprInst), and (ii) codegen these properly as Rust bool types. We might also consider at some point making our "primitive" type hierarchy a bit richer and distinguishing ints and bools, but that's lower-priority.
github-actions[bot] commented on issue #3573:
Subscribe to Label Action
cc @cfallin, @fitzgen
<details>
This issue or pull request has been labeled: "isle"Thus the following users have been cc'd because of the following labels:
- cfallin: isle
- fitzgen: isle
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
fitzgen commented on issue #3573:
FWIW, we use
$trueand$falseelsewhere, eg:Not convinced that
#tand#fis really that much of an improvement.
cfallin commented on issue #3573:
Yep, we'd want to clean up said uses all at the same time.
I'm not as concerned about syntax; we could even just accept tokens
trueandfalse; my concern is more that$trueand$falseare abusing a feature meant for other things (externally-defined constants) and if we have bool values, we should represent them as such in the IR. Getting the type right there would also allow us to use them in the future in other DSL-compiler optimizations.
cfallin labeled issue #3573:
ISLE's prototype compiler was built with the simplifying assumption that all constants are integers. "Symbolic constants" (imported opaque values) like
$MYVALUEwere added later. It's possible to defineboolas a primitive type, but the syntax for bool constants,#tand#f, results in generated code that uses integer values1and0because... everything is (was) an integer. This is clearly suboptimal! In #3572 @alexcrichton used the clever workaround of$false, leveraging the support for arbitrary passthrough of constant names to actually get afalsein the code.We should (i) add a
ConstBoolalongsideConstIntin the IR (PatternInstandExprInst), and (ii) codegen these properly as Rust bool types. We might also consider at some point making our "primitive" type hierarchy a bit richer and distinguishing ints and bools, but that's lower-priority.
Last updated: Dec 13 2025 at 19:03 UTC