<div dir="ltr"><div>Yeah, so the new feature was new enough to change its behavior, but the old feature wasn't...</div><div><br></div><div>I guess you'd call that age before beauty :)</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, Apr 1, 2025 at 12:23 PM Liam Miller-Cushon <<a href="mailto:cushon@google.com">cushon@google.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">I wondered if that was it: arguably it would be good if `<span style="color:rgb(0,0,0)">e instanceof Y` was also an error in this case, but that ship has sailed. There's tension between trying to use new features to fix mistakes of the past, and having a smooth onramp to new features, and I know that's been discussed in other contexts.<br><br>The surprising part to me was that the error was introduced, and then removed as part of the implementation of record patterns.</span></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 1, 2025 at 10:04 AM Archie Cobbs <<a href="mailto:archie.cobbs@gmail.com" target="_blank">archie.cobbs@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 dir="ltr">On Tue, Apr 1, 2025 at 11:49 AM Liam Miller-Cushon <<a href="mailto:cushon@google.com" target="_blank">cushon@google.com</a>> wrote:</div><div class="gmail_quote"><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>So all of this seems deliberate and working as intended, I was just curious what the rationale for the change was. Does anyone remember the history or have pointers to discussions about it on list?</div></div></blockquote><div><br></div><div>I don't know what the stated rationale was at the time, but the change makes intuitive sense to me now: Why should "e instanceof Y x" generate an error when "e instanceof Y" does not? That is to say: the correctness of the type test itself, which is what the error is about, has nothing to do with whether or not you happen to be declaring a new variable that captures a successful outcome of that test.</div><div><br></div><div>-Archie</div><div><br></div></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div>
</blockquote></div>
</blockquote></div><div><br clear="all"></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div>