Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Tweak and implement weak conformance replacement #5371
I know there is rhyme and reason underlying this list of examples, but it's extraordinarily difficult for the casual eye to discern. I worry that anyone looking at this list will find it quite strange and off-putting
in cases where isn't obvious what the inferred type should be, can we make it a compile error unless a type parameter is explicitly supplied? is that a design path that's been explored?
The issue we are addressing here is that we want to follow intuition where it is obvious. Mixing elements of different numeric types gives an
you really want it to mean
val x: Byte = 33
is accepted, since
If I wrote this it would be a mistake. The compiler would infer what I meant, and every future reader would need to infer what I mean, but what I really want is for an error to remind me to either add .0, or just specify the type so nobody has to play computer in their head and infer the type when it is so trivial to just correct the oversight.
I understand this may not be what others want, just offering another perspective.