What's the difference between the #t
/#f
syntax and $true
/$false
? The former is listed in the ISLE language specification, but the latter is used in the ISLE opt/lower rules
#t
and #f
are built into the language and compile to constant 1
and 0
in Rust. I don't think we use them anywhere, they're an artifact of the early ISLE compiler prototype where we didn't really know how the language would be used in detail yet, and we can probably remove them. $true
and $false
are a slight abuse of the $
syntax, which was meant to propagate through symbolic constants to the generated Rust code (and happens to work for Rust keywords like true
and false
); this caught on, it looks better than the Scheme-style #t
/#f
, and we might as well keep using it. The semantic difference I guess would be the types: integer vs. bool
Ah so $ident
are pattern aliases but are opaque to the ISLE compiler?
I'm not sure exactly what you mean by "pattern aliases" but yes, they're opaque tokens just passed through
I mean like how in rust you can use const FOO: usize = ...
in a pattern
ah, sure; except it's a little more general in the sense that it works in expression context (rule right-hand sides) too
Last updated: Dec 23 2024 at 12:05 UTC