asoffer / Icarus

An experimental general-purpose programming language
Apache License 2.0
9 stars 2 forks source link

Unary & binds looser than + #42

Closed asoffer closed 3 years ago

asoffer commented 3 years ago

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, and xor respectively.

This requires us to also make decisions about &= as well as what to do with flags, where the operator seems nicer.

perimosocordiae commented 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.

asoffer commented 3 years ago

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.