risor icon indicating copy to clipboard operation
risor copied to clipboard

Bitwise AND operator

Open rubiojr opened this issue 8 months ago • 1 comments

Should this be accepted?

res := 1 & 0

Raises:

parse error: unexpected token "" following statement

location: test.risor:1:8 (line 1, column 8)

res := 1 & 0
       ^

rubiojr avatar Apr 27 '25 13:04 rubiojr

Yeah, I don't think I left out bitwise operators on purpose. Adding them sounds good.

myzie avatar Apr 27 '25 19:04 myzie

Aha, @rubiojr I remembered why I paused on this originally.

I wasn't sure how to handle its sibling, bitwise or, given that Risor uses | for the pipe operator. So I wasn't sure whether to do both of those in a different way, or whether to just handle bitwise or in a different way.

In any case, I think it's a positive change to introduce bitwise and with &.

https://github.com/risor-io/risor/pull/380

myzie avatar May 15 '25 10:05 myzie