logoalt Hacker News

kibwentoday at 2:16 AM3 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
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