Concise method body + type inference ?
Brian Goetz
brian.goetz at oracle.com
Wed Oct 3 22:17:47 UTC 2018
> I wonder if the concise method body proposal should not be extended to add parameters types/return type inference in case of overriding methods.
In LVTI, we drew a bright line between inference in implementations and
inference in declarations, for a good reason. Clever observers
commented that "but you could safely use `var` to infer the return type
of a private method, without inviting API instability", but we declined
on the basis that the incremental complexity of the rules (having a
coupling between accessibility and inference) was not justified by the
incremental expressiveness. The current rules restrict inference to
local variables, which is nice and clean and orthogonal. I would make
the same argument for not introducing a similar coupling here.
More information about the amber-spec-experts
mailing list