is this because you can then take advantage of all register bits being set to 1 (e.g. in simd code)?
-
-
Replying to @JamesWidman
Not only for simd, it's much, much more consistent behavior throughout. E.g. if `true` is signed, then `~true` is `false` in promoted integer arithmetic. With unsigned `~true` and `false` are different values.
1 reply 0 retweets 1 like -
Replying to @stephentyrone
cc
@AbnerCoimbre because i don't know how Jai treats this1 reply 0 retweets 0 likes -
hm... so if bool was specified at the language level to be a signed int (and two's complement), then for any boolean b: ~b == !b ... which means you can get rid of either ~ or ! (and potentially use that one-token character for something else)
2 replies 0 retweets 1 like -
*er, "one-character token"
1 reply 0 retweets 0 likes -
cc
@Jonathan_Blow because now i'm even more curious about how Jai treats this1 reply 0 retweets 0 likes -
Bool is a separate type from integer with no implicit conversion. If you explicitly cast, true == 1. Whereas I can see some arguments for the all-1s case, I also can think of arguments for why 'true' should be 0, so, uhh, yeah.
1 reply 0 retweets 1 like -
Replying to @Jonathan_Blow @JamesWidman and
You can't get rid of ! because !3 == false, but ~3 == ~3.
1 reply 0 retweets 0 likes -
i didn't think of implicit conversions from Int to Bool in an operand to the ! operator... do you actually depend on that a lot in current Jai projects? (btw it's kind of awesome that you can write a quick metaprogram to just count/report all the places where that occurs)
1 reply 0 retweets 0 likes -
Replying to @JamesWidman @Jonathan_Blow and
(guessing that when you wrote "no implicit conversion", you meant from Bool to Int; presumably Int to Bool is allowed if you can write !3)
1 reply 0 retweets 0 likes
No, it is just that ! is allowed to operate on integer types.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.