https://kotlinlang.org logo
#science
Title
# science
b

bjonnh

12/14/2020, 7:34 PM
it is a pain to do bitwise operations currently
a

altavir

12/14/2020, 7:41 PM
Could you give an example? In all years, I did not find more than a few places where bitwise operations are needed and in those cases 'or' instead of | is fine
b

bjonnh

12/14/2020, 7:43 PM
working with flags, working with binary formats
talking to c libraries especially that make heavy use of flags
a

altavir

12/14/2020, 7:45 PM
Binary formats are usually in capsulated and do not require more than shl. For flags it is better to use something like a bitset.
Multiplatform bitset would be nice, but it easy to add it on the library level.
Native already has a bitset, it seems
b

bjonnh

12/14/2020, 7:55 PM
That's right I always forget about those bitsets
a

altavir

12/14/2020, 7:56 PM
Jvm has its own bitset. A bit more advanced if I remember correctly.
i

Iaroslav Postovalov

12/16/2020, 8:49 AM
I hope you've seen my awesome example of abuse of them:
out << "hello world << lineSeparator()
And it's actually a major reason not to submit them
3 Views