google / pdl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Boolean type

iilyak opened this issue · comments

commented

I couldn't find a way to use bool. Interim I am trying to use:

enum Bool: 1 {
    false = 0,
    true = 1
}

That's definitely something we think about having !
We were reluctant to add this before for several reasons:

  • the use of true / false is often ambiguous, we encourage defining a custom enum with unambiguous names of 0 and 1.
  • we aren't sure if booleans of width greater than 1 should be allowed or not, with which semantics, and how the syntax should be modified for this