News for hackers. Stuff that matters.
Re:Java record pattern matching in JDK 19 by PartiallyTyped on Saturday May 14, 2022 @01:21PM (#31380176)
Mypy (Python) does this as well. VSCode and PyCharm provide typehints after

   if isinstance(foo, str):
        # code
Re:Java record pattern matching in JDK 19 by dehrmann on Saturday May 14, 2022 @04:05PM (#31381825)
Sometimes. If foo isn't local scope, this won't work because it could be modified in another thread.
Re:Java record pattern matching in JDK 19 by cwalv on Sunday May 15, 2022 @01:11AM (#31385418)
I used to find the workaround pretty jarring:

  lfoo = nonlocal_foo
  if isinstance(lfoo, ...):
Since the checker is correct in these cases, I accepted the ugly and got used to it pretty quickly