ubjson / universal-binary-json

Community workspace for the Universal Binary JSON Specification.
115 stars 12 forks source link

Would it make sense to have a proper "boolean" type? #86

Open cousteaulecommandant opened 6 years ago

cousteaulecommandant commented 6 years ago

Disclaimer: this proposal only makes sense if arrays of boolean values are suspected to be needed in real world applications; if they're never really used, it can be ignored and closed.

Although there are already two boolean types, true and false, I think a proper bool type that can take either of the two values could be useful in the case of fixed-type arrays of boolean values. I propose two new boolean types (in addition to the already existing T and F):

Although these types are redundant given that T and F are already a thing, there may be some advantages:

Downsides are:

What do you think? Would these two types (or one of them at least) be useful?

AnyCPU commented 6 years ago

@cousteaulecommandant there should be a good-real-world example. I think the T & F are good enough. There are no reasons to add the B type into the spec for me.

@rkalla What do you think?

Steve132 commented 4 years ago

The main advantage I can think of is for strongly typed arrays we can correctly associate a sequence of booleans without making them T/F