permit with a class which is not a subtype is allowed
brian.goetz at oracle.com
Tue Sep 3 15:41:38 UTC 2019
>> My preference would be for this to be a warning, not an error.
> Conceptually, i've a hard time to think that i want simultaneously a closed hierarchy and let the subtype open by specifying only it's name that may exist or not or that may not visible.PermittedSubtypes then the class is among the permitted subtypes.
You're making an argument that "I can't think of a case where we would
want that." Which is a fine starting point -- it means its not
immediately unreasonable to ask the question "should we outlaw it".
But there's a big leap from "I can't think of any reason to not outlaw
it" to "so we must outlaw it", so let's not prematurely take this leap.
As I said before, there is a tradeoff here, which is between catching
more errors at compile time (good) and imposing more constraints on how
users compile their code (not so good) also possibly constraints on how
code is migrated (also, not so good.)
More information about the amber-spec-experts