<div dir="ltr"><div class="gmail_default" style="font-family:monospace">Hijacking for a second -- Where might one say we have overspent our ad-hoc budget? Purely out of curiosity.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">But very excited to hear that this might also extend to loops and whatnot. That would simplify a lot of code out there.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 13, 2024 at 10:10 AM Brian Goetz <<a href="mailto:brian.goetz@oracle.com" target="_blank">brian.goetz@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div>
<font size="4" face="monospace">As you observe, this is an entirely
reasonable fit for switch. However, if we were to just do labels
like:<br>
<br>
case 1..10:<br>
<br>
this would fall into the category of "ad-hoc syntax-oriented
feature", and our budget for such things is limited (and arguably
overspent.) To make such a feature worthwhile, we'd want to
address ranges more holistically, such as support in loops,
arrays, ranges of other ordered types (such as long or enums),
etc. Which is a totally reasonable feature to consider, but is
also more significant in scope. <br>
<br>
<br>
</font><br>
<div>On 3/13/2024 8:16 AM, Red IO wrote:<br>
</div>
<blockquote type="cite">
<div dir="auto">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.
<div dir="auto">Example case x is between y and z.</div>
<div dir="auto">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. </div>
<div dir="auto"><br>
</div>
<div dir="auto">Great regards </div>
<div dir="auto">RedIODev </div>
</div>
</blockquote>
<br>
</div>
</blockquote></div>