Sealed types

Doug Lea dl at cs.oswego.edu
Sun Dec 9 13:16:47 UTC 2018


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


More information about the amber-spec-experts mailing list