-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
It's surprising that the language supports bitwise binary operators but not the C "complement" (~) operator. It is very useful when dealing with bit strings that represent flags, value & ~mask == desired. Granted that a workaround exists, XOR with -1.
A more complicated case is simple integer negation, -X. I just found out that the Go implementation does not support negative literal integers (-100) (the Rust code does, I believe). I tried to add them by tweaking the lexer but this results in a parser ambiguity, e.g. when parsing 200-100. One simple solution is for the lexer to only support positive literals and the parser to deal with the minus/negation distinction, but that would necessitate integer negation as a unary operator.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels