[swift-evolution] protocol-oriented integers (take 2)

Dave Abrahams dabrahams at apple.com
Sat Jan 14 18:06:29 CST 2017


on Fri Jan 13 2017, Max Moiseev <swift-evolution at swift.org> wrote:

> So, in an expression `x &>> 32`, compiler assumes 32 to have type Int
> (which is the default type for the integer literals) and prefer the
> heterogeneous overload. It might not be too bad, as I showed in
> examples above, but in order to increase chances of success you might
> want to specify an explicit type context, as in `x &>> (32 as
> TypeOfX)`.

It's easy to prove that the heterogeneous overload can't have different
semantics from the homogeneous one, so there is absolutely nothing to
worry about—other than, arguably, that it could take slightly more
time to type-check.

-- 
-Dave



More information about the swift-evolution mailing list