News for hackers. Stuff that matters.
Re:Java record pattern matching in JDK 19 by Smaug123 on Saturday May 14, 2022 @01:00PM (#31379919)
F# also has:

  let foo : obj = failwith ""

  match foo with
  | :? SomeType as blah ->
      // use blah : SomeType
(You're allowed to just use the identifier `foo` in the match arm.)
Re:Java record pattern matching in JDK 19 by halfmatthalfcat on Saturday May 14, 2022 @02:11PM (#31380689)
As does Scala:

  match thing {
    case a: String => 
      // use a as string
    case a @ MyCaseClass(b: String, c, d) =>
      // use a as the instance of MyCaseClass or use b as a string
  }