Vectrex32

General Category => Feature Requests and Bug Reports => Topic started by: jaymzjulian on November 13, 2019, 06:46:39 PM

Title: Feature Request: Bitwise operators on integers in gsbasic
Post by: jaymzjulian on November 13, 2019, 06:46:39 PM
Logical operators are true/false only, but it'd be nice to do something like:

' between 0 and 7
a = a & 7
' set bit 4
a = a | 4

when doing things like dealing wth the AY particularly, of course :).  Maybe use the C-style operators of &/|/^, since the letter ones already have clear meaning that should not be changed under people :)
Title: Re: Feature Request: Bitwise operators on integers in gsbasic
Post by: Vectrex32 on November 13, 2019, 08:21:02 PM
I think this could be arranged.

- Bob
Title: Re: Feature Request: Bitwise operators on integers in gsbasic
Post by: Vectrex32 on November 13, 2019, 08:24:50 PM
Oops ... ^ is already being used for exponents. I could have an 'xor' operator, but that's going to mess people up. Everyone who sees & and | is going to expect ^ for xor, and they're going to be plenty confused if they get an exponent.

- Bob
Title: Re: Feature Request: Bitwise operators on integers in gsbasic
Post by: Vectrex32 on November 13, 2019, 08:34:43 PM
Meanwhile, AND and OR do short-circuit evaluation in IF statements, so I can't use them as bitwise operators. Visual Basic solves this by using AndAlso and OrElse for short circuit evaluation. But for me to do it Visual Basic's way would be a breaking change to the V32.

:-( :-(

- Bob