I see a problem here: sometimes the “wanted” behavior isn’t actually wanted at all. like:
extension Int8
{
func asOffset<I>(from base:I) -> I where I:BinaryInteger
{
return I(self) + base
}
}
let field:Int8 = 4
print(field.asOffset(from: 0x400000))
The 0x400000
is probably a hardcoded pointer and the intent here was really
field.asOffset(from: 0x400000 as Int)
but with Xiaodi’s proposal it becomes an error.