Draft JEP on Primitive types in patterns, instanceof, and switch

forax at univ-mlv.fr forax at univ-mlv.fr
Thu Jan 26 21:37:12 UTC 2023


> From: "Pedro Lamarão" <pedro.lamarao at prodist.com.br>
> To: "Kevin Bourrillion" <kevinb at google.com>
> Cc: "Per-Ake Minborg" <per-ake.minborg at oracle.com>, "Remi Forax"
> <forax at univ-mlv.fr>, "Angelos Bimpoudis" <angelos.bimpoudis at oracle.com>,
> "amber-dev" <amber-dev at openjdk.org>
> Sent: Thursday, January 26, 2023 10:09:43 PM
> Subject: Re: Draft JEP on Primitive types in patterns, instanceof, and switch

> Em qui., 26 de jan. de 2023 às 17:55, Kevin Bourrillion < [
> mailto:kevinb at google.com | kevinb at google.com ] > escreveu:

>> Depending on float equality is *dangerous*, but doesn't completely lack valid
>> use cases.

> With some kind of epsilon predicate, this should become more useful.

I think you will have to wait for the introduction of named patterns for this one, something like 

case Double.around(10.0, EPSILON)(double d) -> ... 

With the mention that this is obviously not the real syntax but a snippet of code to help to drive the discussion. 

> --
> Pedro Lamarão

regards, 
Rémi 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230126/a4d27b3c/attachment.htm>


More information about the amber-dev mailing list