[swift-evolution] Rename Number Type Bitwise Operators

Chris Lattner clattner at apple.com
Thu Jan 7 23:45:48 CST 2016


> On Jan 7, 2016, at 8:42 PM, Dave via swift-evolution <swift-evolution at swift.org> wrote:
> 
> While we’re (sorta) on the topic, is there any chance the bitwise operators (“&”, “|”, and "^") could be renamed to ".&”, ".|”, and ".^”? Or maybe only defined for some sort of Bitfield<T> wrapper type? “^” already has a numeric meaning (3^2 = 9), and “|” and “&” are a convenient custom operators (they’re easy to recognize and I think are the only two single-character vclid operators that doesn’t require obscure keystrokes to type and don’t already have a fairly obvious meaning).

Almost certainly no.  The bar for diverging for the C family precedent on this is very high.  Saying that you want to rename (e.g.) ^ to .^ so that you can repurpose ^ for some other thing is extremely unlikely to happen.

If you are really interested in exponentiation, ** is a better path to follow.  However, even that has a number of problems that the numerics folks will jump onto :-)

-Chris


More information about the swift-evolution mailing list