The code to test for example for "positive fixint" looks like
first_byte.bit_and(0b10000000).is_nonzero
which IMHO is un-intuitive.
It would be nice to write something along the lines:
first_byte =~ b/0xxxxxxx/
This would require a new BitMask type and a new literal to create it. Once we have custom string literals (#247), we could create e.g. a BitMask using something like '0xxxxxxx'_bitmask. This would actually be simple if we had some kind of comptime evaluations, then we could just add a method bitmask! on String.
Just looking at msgpack spec, which defines a table like this to decode the type of the following value:
The code to test for example for "positive fixint" looks like
which IMHO is un-intuitive.
It would be nice to write something along the lines:
This would require a new
BitMask
type and a new literal to create it. Once we have custom string literals (#247), we could create e.g. aBitMask
using something like'0xxxxxxx'_bitmask
. This would actually be simple if we had some kind of comptime evaluations, then we could just add a methodbitmask!
on String.