Many languages which have &&
and ||
(or otherwise) as short-circuiting logical operators also have &
and |
for the eager operators.
You can see a list here, but some notable languages include C, C#, Java, JavaScript, Objective-C, Perl, PHP, Python, R, Rust and Swift. The same list doesn't show any languages which use &
and |
as short-circuiting operators, though apparently Oberon has &
and OR
.
Breaking conventions isn't necessarily bad; but if you do want to have &
and |
as your short-circuiting operators, then you will have to consider whether you also want eager operators, and if so what they should be ─ and if it is really worth violating expectations by giving your short-circuiting operators the syntax usually used for eager operators.
Also keep in mind when designing a language that you have a limited strangeness budget, which is usually better spent on things which make your language semantically or paradigmatically different to other languages, rather than on syntax.
&&
and||
were added to C as a kind of compromise, because&
and|
were already taken in BCPL and B, which used them as both logical and arithmetic operators. It’s obviously well established as a convention by now, but apart from familiarity, there’s no strong reason to follow that precedent, especially if bitwise operations aren’t so central to the language. $\endgroup$and
andor
? $\endgroup$