Re:Java record pattern matching in JDK 19
by smarks on Saturday May 14, 2022 @07:37PM
(#31383787)
Several folks have pointed out the poor style in calling static methods using an instance. I think you have a good point, but not a good example. Perhaps a better example is with overload resolution. Consider this Kotlin code:
It's as if smart casting causes the static type of `n` to change in different parts of the main function. As such it also seems to affect overload resolution. Maybe this is exactly what you want. On the other hand it seems like it could lead to some very subtle errors. I'm not a Kotlin programmer, so Kotlin experts please feel free to correct me on details.
[ Parent
| on HN ]
There are no comments on this comment yet.