Comparing ranges with switch

David Alayachew davidalayachew at gmail.com
Wed Mar 13 13:09:57 UTC 2024


Brian himself told me it is on the way, there are just higher priority
amber features (for example, member patterns) that need to be worked on
first.

Which makes sense, range patterns are incredibly useful and feel like they
are filling a hole in the language, but they only apply to numbers
currently. Maybe to more after Valhalla releases some stuff.

On Wed, Mar 13, 2024, 8:17 AM Red IO <redio.development at gmail.com> wrote:

> The switch statement saw a huge transformation over the past few releases.
> So I was quite surprised to realize that the current switch construct can't
> check the range of an value.
> Example case x is between y and z.
> I'm most likely not the first one to notice that. Is there any discussion
> about adding some sort of range pattern? Would fit in the notion of the
> switch checking patterns quite well.
>
> Great regards
> RedIODev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20240313/c511c1ca/attachment.htm>


More information about the amber-dev mailing list