News for hackers. Stuff that matters.
Re:ᚣ the Rune Programming Language by troymc on Sunday November 27, 2022 @09:07AM (#33763008)
It looks like Rune still has a bitwise XOR operator: @

https://github.com/google/rune/blob/main/bootstrap/database/...

That innovation does seem like a potential footgun.

Re:ᚣ the Rune Programming Language by kibwen on Sunday November 27, 2022 @09:35AM (#33763186)
Here's my hot take: if you're designing a new programming language in the modern era, even a systems language, ignore the precedent of C and don't use &|^~ as bitwise operators. You can still have infix bitwise operators, but spell them out as bitand/bitor/bitxor/bitnot. Then you can just use &| for logical and/or, which are 1000x more common than bitwise and/or, and you can reclaim ^ for exponentiation as well. And don't forget to fix C's broken bitwise operator precedence while you're at it.
Re:ᚣ the Rune Programming Language by lvass on Sunday November 27, 2022 @10:06AM (#33763381)
Hard disagree on single characters for logic and exponentiation. ASCII has too few special characters and you'd want to use those elsewhere, without creating ambiguity. Elixir got it right.
Re:ᚣ the Rune Programming Language by PointyFluff on Sunday November 27, 2022 @12:29PM (#33764703)
ASCII has tones of unused chars we could grab for coding.
Re:ᚣ the Rune Programming Language by junon on Sunday November 27, 2022 @12:56PM (#33764951)
Mm yes but BEL is not a character that can be typed on a keyboard with any amount of ease.
Re:ᚣ the Rune Programming Language by dragonwriter on Sunday November 27, 2022 @01:02PM (#33764996)
> ASCII has too few special characters

Unicode, OTOH, doesn’t have this problem.

Re:ᚣ the Rune Programming Language by josephg on Sunday November 27, 2022 @01:24PM (#33765212)
True, but we don’t have Unicode keyboards.
Re:ᚣ the Rune Programming Language by mumblemumble on Sunday November 27, 2022 @12:00PM (#33764403)
Interesting. I'd go the other way. Continue using single-character bitwise operators, but spell out "and" and "or" for the logical operators.

Rationale: in normal usage, short-circuiting logical operators are, in effect, a special kind of control flow statement, and control flow statements are typically spelled out. Bitwise operators are more unequivocally meant for calculation, and therefore perhaps more deserving of similar syntax to the arithmetic operators, despite their less frequent usage.

I think that this way of drawing the distinction might be particularly relevant in a language that disallows conditional branching - and, by extension, short-circuiting logical operations - such as Rune.

Re:ᚣ the Rune Programming Language by nerdponx on Sunday November 27, 2022 @12:34PM (#33764757)
This is exactly what Python did and it works out very well for the most part.
Re:ᚣ the Rune Programming Language by benibela on Sunday November 27, 2022 @07:32PM (#33768486)
Or the Pascal way. "And"/"or" for logical operators on bools. "And"/"Or" for bitwise operators on integers

With a strong type system, it knows if the input is bool or integer

Re:ᚣ the Rune Programming Language by npn on Sunday November 27, 2022 @08:13PM (#33768741)
Some language use three characters for bitwise operators, like `>>>`, `!!!`, `&&&`. I think it is a good compromise.
Re:ᚣ the Rune Programming Language by sacnoradhq on Sunday November 27, 2022 @04:12PM (#33767024)
Sheer insanity. Sensible languages use ** for exponentiation and ^ for xor.