HyperDex icon indicating copy to clipboard operation
HyperDex copied to clipboard

boolean datatype

Open mwotton opened this issue 10 years ago • 5 comments

also a nice-to-have, I suppose.

mwotton avatar Mar 14 '14 07:03 mwotton

I don't know that I'll be adding a boolean datatype. The C programmer in me says "int" is good enough, and avoiding the additional code complexity of adding a "bool" trumps having meaningfully distinct types. We're adding support for JSON objects, so you can use bool types there.

rescrv avatar Mar 16 '14 01:03 rescrv

""" The New Jersey guy said that the Unix solution was right because the design philosophy of Unix was simplicity and that the right thing was too complex. Besides, programmers could easily insert this extra test and loop. The MIT guy pointed out that the implementation was simple but the interface to the functionality was complex. The New Jersey guy said that the right tradeoff has been selected in Unix-namely, implementation simplicity was more important than interface simplicity.

The MIT guy then muttered that sometimes it takes a tough man to make a tender chicken, but the New Jersey guy didn't understand (I'm not sure I do either). """

:) but it's your project.

mwotton avatar Mar 16 '14 11:03 mwotton

I'll reconsider, but I don't know that there's much that can be gained. Maybe if the implementation was different than simply a copy of "int", there'd be an advantage to having that additional complexity. As it stands, the bool data type will be functionally identical to int, with the same interface at the C level.

SA_RESTART has been around for quite some time, and completely sidesteps the NJ/MIT debate. If we waited for the MIT guy to get everything 100% right from the get-go, we'd probably have the perfect OS a decade from now, with nothing usable until then.

rescrv avatar Mar 16 '14 14:03 rescrv

What might be more worth the time to change the API would be a bitvector. As a data type, it has more interesting atomic operations and use cases. It also means if people want to store lots of boolean values, they can and it'll be appropriately sized in the database.

If ops allowed passing a list of indices to set, a list of indexes to return the "AND" or "OR" of, or retrieve an individual bit, you can implement a distributed bloom filter. Bool would just be an alias for the case of a length 1 vector and only support get/set.

AaronFriel avatar Apr 01 '14 16:04 AaronFriel

+1

I would like boolean fields to show up as true/false in tools/admin-interfaces.

Dretch avatar Apr 07 '15 11:04 Dretch