logoalt Hacker News

kibwentoday at 2:16 AM5 repliesview on HN

Please don't, inscrutable bitwise operators are an accident of the past even in systems languages, let alone in a scripting language. I'm not against infix operators for bitwise operations, just please spell them out with keywords rather than giving them sigils.

Likewise, going from `and` and `or` to `&&` and `||` would be a dispiriting regression. This is something that Zig got right.


Replies

Dylan16807today at 4:58 AM

What kind of person understands and needs bitwise operators but can't easily remember & | ~ and the arrows for shift? It's very little information.

The part I'd call a hassle is the different kinds of right shift but you have that same hassle if you use keywords.

I like using the and/or keywords for logical operations. Now let's make bitwise look significantly different from that.

show 1 reply
astrobe_today at 6:27 AM

You can have them in C/C++ at least [1]

[1] https://en.cppreference.com/cpp/language/operator_alternativ...

gautamcgoeltoday at 3:10 AM

Doesn't Zig also have bitwise operators?

JSR_FDEDtoday at 2:21 AM

The btiwise operators library doesn’t go away

krapptoday at 9:55 AM

I'm going to disagree only because one of the primary use cases for LuaJIT is interop with C and I think there's a case for making the ergonomics match.