Closed asoffer closed 3 years ago
Big +1 to spelling out operators where possible. I'd be happy with and
meaning the logical operator and &
meaning the bitwise operator. That would let us keep in-place versions like &=
if desired.
I like &
for bitwise, but what about logical conjuctive-assignment?
my_bool and= something
? This feels really weird, but at least resolves the ambiguity of does assignment do short-circuiting? Answer: and=
yes, because and
does short-circuiting.
This is because we have the same precedence levels for unary and binary &, and binary & binds looser than +. This is certainly fixable in the parser, but it might be nicer to take this opportunity to revisit logical &, |, and ^, spelling them as
and
,or
, andxor
respectively.This requires us to also make decisions about
&=
as well as what to do with flags, where the operator seems nicer.