<div dir="ltr"><div class="gmail_default" style="font-family:monospace">Sorry, the flattened version I linked to included a default clause at the bottom. Leftover from when I was debugging.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Here is one that is exhaustive without a default clause.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace"><a href="https://github.com/davidalayachew/HelltakerPathFinder/blob/10b7a9d5fc4f6f563a68824de9a70735c7533226/src/main/java/HelltakerPathFinderModule/HelltakerPathFinderPackage/Board.java#L512" target="_blank">https://github.com/davidalayachew/HelltakerPathFinder/blob/10b7a9d5fc4f6f563a68824de9a70735c7533226/src/main/java/HelltakerPathFinderModule/HelltakerPathFinderPackage/Board.java#L512</a></div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">And fun fact -- debugging my missing case was so difficult, that to speed things up, I wrote a little script to print out all major permutations of my cases, then used <b><u><i>String</i></u></b> pattern-matching to eliminate the cases lol. Object pattern-matching was taking too long to debug so I had to go back to Strings and play whack a mole that way lol. Let me know if you need more details.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 11, 2025 at 3:22 PM David Alayachew <<a href="mailto:davidalayachew@gmail.com" target="_blank">davidalayachew@gmail.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"><div dir="ltr"><div class="gmail_default" style="font-family:monospace">Hey Chen,</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Sure.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Here is the old nested Switch version.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace"><a href="https://github.com/davidalayachew/HelltakerPathFinder/blob/12c57dab041924192b8613075ff6966b1b159e91/src/main/java/HelltakerPathFinderModule/HelltakerPathFinderPackage/Board.java#L511" target="_blank">https://github.com/davidalayachew/HelltakerPathFinder/blob/12c57dab041924192b8613075ff6966b1b159e91/src/main/java/HelltakerPathFinderModule/HelltakerPathFinderPackage/Board.java#L511</a></div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">And here is the new flattened switch version.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace"><a href="https://github.com/davidalayachew/HelltakerPathFinder/blob/b0e8359e429967758b1ded02b818b8d46ed05b32/src/main/java/HelltakerPathFinderModule/HelltakerPathFinderPackage/Board.java#L512" target="_blank">https://github.com/davidalayachew/HelltakerPathFinder/blob/b0e8359e429967758b1ded02b818b8d46ed05b32/src/main/java/HelltakerPathFinderModule/HelltakerPathFinderPackage/Board.java#L512</a></div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">I specifically made these links so that they link to the commit. So, you can browse the files, as they were at the time of that commit.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">But lol, hopefully looking at these can show you the night and day difference that I am talking about in readability? Or the ability to forget a case in the nested way? Flattened way outright FORBIDS me forgetting a case BECAUSE record patterns in Switch demand exhaustiveness. Semantically speaking, I almost feel like the flattened version is more accurate of my true intention, and less likely to be wrong.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 11, 2025 at 11:38 AM Chen Liang <<a href="mailto:chen.l.liang@oracle.com" target="_blank">chen.l.liang@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"><div>
<div dir="ltr">
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi David,</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
I wonder if your code is open for review. If you can provide your actual code, I think we can have a better grasp of the whole situation.</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:"Calibri Light","Helvetica Light",sans-serif;font-size:12pt;color:rgb(0,0,0)">
Regards, Chen Liang</div>
<div id="m_5959196966937480881m_-3209634718178701681m_8405795875297762339appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_5959196966937480881m_-3209634718178701681m_8405795875297762339divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amber-dev <<a href="mailto:amber-dev-retn@openjdk.org" target="_blank">amber-dev-retn@openjdk.org</a>> on behalf of David Alayachew <<a href="mailto:davidalayachew@gmail.com" target="_blank">davidalayachew@gmail.com</a>><br>
<b>Sent:</b> Sunday, May 11, 2025 9:48 AM<br>
<b>To:</b> amber-dev <<a href="mailto:amber-dev@openjdk.org" target="_blank">amber-dev@openjdk.org</a>><br>
<b>Subject:</b> Re: Sharing my experience with Switch Expressions</font>
<div> </div>
</div>
<div>
<div dir="auto">Let me also add one thing.
<div dir="auto">
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">I had started this project before Record Patterns had been released. So, it was only incidentally that I had ended up using a set of nested Switch Expressions -- I was forced to back then.</div>
<div dir="auto"><br>
</div>
<div dir="auto">I know for a fact that, had I been given the opportunity, I would have done things flat from the beginning. Nesting switch expressions is definitely not my first choice.</div>
</div>
</div>
</div>
</div></blockquote></div>
</blockquote></div>