merging cases in between values and types
forax at univ-mlv.fr
forax at univ-mlv.fr
Wed Sep 8 16:15:18 UTC 2021
> From: "Brian Goetz" <brian.goetz at oracle.com>
> To: "Remi Forax" <forax at univ-mlv.fr>, "amber-spec-experts"
> <amber-spec-experts at openjdk.java.net>
> Sent: Mercredi 8 Septembre 2021 17:08:59
> Subject: Re: merging cases in between values and types
> It doesn't really matter, since 42 is subsumed into Integer anyway. Null is the
> weirdo (as always.)
??,
currently we allow null but not 42.
Rémi
> On 9/8/2021 2:42 AM, Remi Forax wrote:
>> Hi all,
>> the current spec support merging/fallthrough cases only when there is a case
>> null,
>> like
>> case null, case Integer i -> // i can use 'i' here
>> First, i'm not sure it's clearly written in the spec, i was not able to pinpoint
>> the rule allowing it.
>> Then i wonder if this special behavior is special because null is special or if
>> it should work with any values of the type of the type pattern,
>> i.e. it works because null is a possible value of Integer, in that case, it
>> should also work with any other values like 42
>> case 42, case Integer i -> // i can use 'i' here
>> So is null a special value or does this rule also work with any values.
>> regards,
>> Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20210908/6e0ce61e/attachment.htm>
More information about the amber-spec-experts
mailing list