Refinements for sealed types

forax at univ-mlv.fr forax at univ-mlv.fr
Mon Aug 19 22:40:40 UTC 2019


> De: "Brian Goetz" <brian.goetz at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
> Envoyé: Lundi 19 Août 2019 15:07:35
> Objet: Re: Refinements for sealed types

>>> There are several ways to reduce the ceremony
>>> - implicit declaration of sealed subtypes if the super type is sealed
>>> - implicit declaration of permit clauses
>>> and we may want to choose one, the other or both.
> For the record, there is also a third possible way: inferring `extends X`. I
> don’t particularly love it, especially as it is mutually exclusive with
> inferring the permits clause. But I include it for completeness.

We tried that by saying if you are inside the declaration of a sealed type, the extends can be inferred but it doesn't play well with inner classes that are already using the fact that there are enclosed to have another semantics. 
Basically going in that direction means separating the sum type use case (which in that case will have its own syntax) and the closed hierarchy use case (which can use the keyword sealed). 

Rémi 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190820/577d638b/attachment-0001.html>


More information about the amber-spec-experts mailing list