On Thu, 17 Oct 2002, Brent Dax wrote:
: Shapiro, Jonathan:
: # Well, let's look at a few possibilities:
: #
: # 1) if( $vec bit| $mask bit& $mask2 )
: #
: # 2) if( $vec b| $mask b& $mask2 )
: #
: # 3) if( $vec |b $mask &b $mask2 )
: #
: # 4) if( $vec |bit $mask &bit $mask2 )
:
: What's wrong with 'bitand' and 'bitor' (or even 'mask' and 'combine', or
: something to that effect)?
:
: 5) if( $vec bitor $mask bitand $mask )
:
: 6) if( $vec combine $mask mask $mask )
I find those difficult to read--too wordy. At the moment I'm leaning towards
$a .| $b # bitwise or
$a .& $b # bitwise and
$a .! $b # bitwise xor
.! $b # bitwise not
$a ! $b # logical xor
! $b # logical not
I think the "." looks kind of like a bit. A ":" would also work, and risk
less confusion with method call syntax. But the "." is better at getting out
of the way visually. As a productive prefix, it has limits, but there are
actually very few operators that make sense to be bitified, and none of them
look like a method name.
I like the notion that binary ! means that the two sides are sharing one "not".
That's the definition of XOR in a nutshell.
I also like the idea that ~ is entirely freed up for some other nefarious use.
Larry