Compile-time type hierarchy information in pattern switch
brian.goetz at oracle.com
Thu Apr 5 15:25:36 UTC 2018
Yes, this is surely an option.
But it doesn't answer the underlying question -- if the hierarchy
changes in various ways between compile and runtime, what behavior can
the user count on, and what changes yield "undefined" behavior?
While its easy to say "you should do what the code says", taking that
too far ties tie our hands behind our back, and makes switches that
should be O(1) into O(n).
On 4/5/2018 11:21 AM, Remi Forax wrote:
> Or we can not try to do any check at runtime that validate the view of the world at compile time.
> Currently, there is no check that verifies that the catch are in the right order or that a cascade of if-instanceofs means the same thing at compile time and at runtime.
> My opinion, we should just run the code that was compiled, even if the world as changed between the compilation and the execution.
More information about the amber-spec-observers