Deconstructing Records in Pattern Matching - Inside Java Newscast #26

Ғылым және технология

JavaOne is back! ➱ oracle.com/javaone
How record patterns use records' transparency to safely deconstruct them in pattern matching, allowing us to separate checking structure and value of data from processing it.
___ Chapters ___
0:00 ➠ cough
0:30 ➠ Intro
JEP 405: openjdk.java.net/jeps/405
Inside Java Newscast #8: • Incremental Evolution,...
Inside Java Newscast #24: • WHEN and NULL In Patte...
Pattern Matching in Java: • Pattern Matching in Ja...
1:12 ➠ Deconstruction - Record Recap
Record semantics: nipafx.dev/java-record-semant...
2:21 ➠ Deconstruction - Extracting, Checking, Processing
3:50 ➠ Deconstruction - JEP 405
5:58 ➠ Recharge
6:08 ➠ Speculations
Amber mailing list: mail.openjdk.java.net/mailman...
inside.java: inside.java/
Java Reddit: / java
@Java: / java
@nipafx: / nipafx
7:57 ➠ Outro
Tags: #Java #Java19 #JDK19 #OpenJDK #ProjectAmber #PatternMatching

Пікірлер: 19

  • @zaccicala2341
    @zaccicala23412 жыл бұрын

    Inline deconstructing returned records would be a really sick feature.

  • @nipafx

    @nipafx

    2 жыл бұрын

    I think so, too! Let's hope the Project Amber folks deem it worthy! 🤞🏾

  • @nielsdestickere1909
    @nielsdestickere19092 жыл бұрын

    It appears the current proposal uses positional destructuring, much the same way that method and constructor argument lists are positional, which is a bit of a shame. This greatly limits the usefulness of destructuring objects into its constituent parts. No one in their right mind would destructure a record of more than 3 fields if it requires declaring each and every field even when you don't care about some of them. There's also the issue of destructuring records à la "record SomeObject(String a, String b) {}". When, for whatever reason, someone decides to shift the declarations around, there's nothing except your testsuite to warn you that you've broken something somewhere in your codebase. Even the Kotlin language architects came out and admitted that positional destructuring was a mistake they made and that they should have opted for structural composition. While I have some reservations about the proposal as presented, I do feel there is merit to it. Granted, for small, localized, unambiguous records. Apologies for the rant...

  • @VisruthCV
    @VisruthCV2 жыл бұрын

    Very informative update. Thanks for publishing!

  • @derrickheng564
    @derrickheng5642 жыл бұрын

    Thanks mate. Very helpful.

  • @dd1.d
    @dd1.d2 жыл бұрын

    wow! can't wait for destructing records in java

  • @tanveerhasan2382

    @tanveerhasan2382

    2 жыл бұрын

    Soon, brother

  • @user-ms5no1wu7y
    @user-ms5no1wu7y Жыл бұрын

    I hope that single underscore as a variable name will be re-introduced with a similar semantics that "blank identifier" in GO has.

  • @sommyaruproy8405
    @sommyaruproy84052 жыл бұрын

    Damn this makes nested processing of data much easier 👍

  • @DeepakLalchandaniProfile
    @DeepakLalchandaniProfile2 жыл бұрын

    Can you please post a working example to illustrate the scenario of deconstructing records in pattern matching for learning purposes

  • @askarkalykov
    @askarkalykov2 жыл бұрын

    Would be great to also instanceof check components like OrderEvent(_, VipOrder v) ; OrderEvent(_, Order usualOrder)

  • @nipafx

    @nipafx

    2 жыл бұрын

    If `VipOrder extends/implements Order` (i.e. `Order` is no record) that would absolutely work. 👍

  • @askarkalykov

    @askarkalykov

    2 жыл бұрын

    @@nipafx that's great! 😃 👍 I really like the direction Java is heading to, thank you and all the devs who are involved into making Java even more sexy and practical 👍👍👍

  • @albertpiekielny4952
    @albertpiekielny49522 жыл бұрын

    before destructorisation in Java: JS !== Java, and after JS != Java :P

  • @dcascato
    @dcascato2 жыл бұрын

    Javaaaaaaa!!!

  • @user-sr7ns9se2c
    @user-sr7ns9se2c Жыл бұрын

    Hello Scala

  • @alexeibrinza2719
    @alexeibrinza27192 жыл бұрын

    Java going towards Javascript with its destruction

  • @brianwest7344
    @brianwest73442 жыл бұрын

    If you want to know why there is a shortage of hair gel product in the world just watch this video.

  • @cetaepsilon
    @cetaepsilon2 жыл бұрын

    LOL all this is Scala stuff. All these JDK iterations are basically Java stealing Scala features one by one.

Келесі