Hi Doug,
using colon ':' will cause trouble to people that discover Java after having 
used C or C# given that ':' is used to introduce supertypes in those languages.

Your proposed compact declaration is a mess visually if you declare a subtype 
which is a sealed interface with a list of subtypes, because it becomes a tree.

Rémi

----- Mail original -----
> De: "Doug Lea" <d...@cs.oswego.edu>
> À: "Brian Goetz" <brian.go...@oracle.com>, "amber-spec-experts" 
> <amber-spec-experts@openjdk.java.net>
> Envoyé: Dimanche 9 Décembre 2018 14:16:47
> Objet: Re: Sealed types

> On 12/7/18 1:43 PM, Brian Goetz wrote:
>>> Maybe "permits" -> "exclusivelyIncludes" or just "exclusively"? These
>>> seem less likely to be misinterpreted and also less likely to lead to
>>> any confusion with not-rare use of "permits" as a variable (in
>>> semaphores etc).
>> 
>> Good thought.
> 
> The main thought is to clarify that these are exclusive/complete types,
> as used in UML etc requirements.
> 
> There are also some syntax holes that don't even need reserved words.
> Colon+parenthesized list seems OK:
> 
> final interface Node : (A, B, C) { ... }
> 
> ... and would allow even more compact declaration if the list elements
> could be either names or full definitions:
> 
> final interface Node : (
>  record IntNode(int value),
>  record PlusNode(Node left, Node right),
>  record NegNode(Node node)
> ) {
>  public void evaluate();
> }
> 
> -Doug

Reply via email to