Relaxed assignment conversions for sealed types

Remi Forax forax at univ-mlv.fr
Mon Jan 25 12:55:46 UTC 2021


> De: "Brian Goetz" <brian.goetz at oracle.com>
> Cc: "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
> Envoyé: Vendredi 22 Janvier 2021 18:27:25
> Objet: Re: Relaxed assignment conversions for sealed types

> I want to pick up on this thread, now that we may have some more fire to add to
> it, and we've all had some time to think about it.
[...] 

> I think these things are the same feature. So what if:

> total-switch (x) { ... } // or switch-total

> meant "I assert this switch is total, please error if it is not."
Just from a pure syntax POV, i wonder if 
switch(total x) { ... } 
is not more in line with the other usages. 

It's just a trick but it looks more like a keyword that a special switch. 

[...] 

> And

> case Foo(total Bar x)

> meant "I assert that this nested pattern is total, please error if not."

> In all cases, this doesn't change the semantics, it doesn't *make* anything
> total -- it just provides a way to capture the design intent in a way the
> compiler can type-check it.
+1 for me. 

Rémi 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20210125/6f3a3f6d/attachment-0001.htm>


More information about the amber-spec-experts mailing list