• nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    2 years ago

    How do you name unused variables? If even just having to make that choice annoys you (it's not just me, right?), read on for how #JavaNext will fix that and make pattern matching (how's that related?!) more maintainable in the process. 🧵

    22 14 28 49K 5
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    2 years ago

    TL;DR: Unused variables suck. They're rare now, but will be more prevalent soon. JEP 443 proposes to replace them with _ for cleaner code and better pattern matching. "This 🧵 should've been 📰" ⇝ nipafx.dev/inside-java-ne… "This 🧵 should've been 📽️" ⇝ youtube.com/watch?v=nP1k41…

    1 3 11 2K 2
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    2 years ago

    Whether it's lambda parameters, catch clauses, try-with-resources, or other places: Sometimes we need to declare variables that we don't use and that sucks: * what to name them? * visual clutter / distraction * compiler / linter warnings

    nipafx tweet picture
    nipafx tweet picture
    nipafx tweet picture
    keyboard_arrow_left Previous keyboard_arrow_right Next

    1 2 4 1K 0
    Download Image
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    2 years ago

    And it's only going to get worse! When destructuring, it's common not to need all components. Already not good, but so far that only happens with pattern matching over records, but soon we may be able to: * destructure "regular" objects * use destructuring in other places

    nipafx tweet picture
    nipafx tweet picture
    nipafx tweet picture
    keyboard_arrow_left Previous keyboard_arrow_right Next

    2 2 5 2K 0
    Download Image
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    2 years ago

    So JEP 443 (openjdk.org/jeps/443) proposes unnamed variables and patterns. In a nutshell: * Use `_` instead of variable name (optionally with `var`) or nested pattern. * You can't refer to it, i.e. no `_ = "foo"` or `_.size()`. * Multiple `_` in the same scope work.

    nipafx tweet picture
    nipafx tweet picture
    keyboard_arrow_left Previous keyboard_arrow_right Next

    1 2 13 2K 0
    Download Image
  • alexander_kiel Profile Picture

    Alexander Kiel 🇪🇺🇺🇦 @alexander_kiel

    2 years ago

    @nipafx But why should destructuring require me to specify all components? That would mean, I need to change my code if I add say a field to a record.

    1 0 0 17 0
  • Download Image
    • Privacy
    • Term and Conditions
    • About
    • Contact Us
    • TwStalker is not affiliated with X™. All Rights Reserved. 2024 www.instalker.org

    twitter web viewer x profile viewer bayigram.com instagram takipçi satın al instagram takipçi hilesi twitter takipçi satın al tiktok takipçi satın al tiktok beğeni satın al tiktok izlenme satın al beğeni satın al instagram beğeni satın al youtube abone satın al youtube izlenme satın al sosyalgram takipçi satın al instagram ücretsiz takipçi twitter takipçi satın al tiktok takipçi satın al tiktok beğeni satın al tiktok izlenme satın al beğeni satın al instagram beğeni satın al youtube abone satın al youtube izlenme satın al metin2 metin2 wiki metin2 ep metin2 dragon coins metin2 forum metin2 board popigram instagram takipçi satın al takipçi hilesi twitter takipçi satın al tiktok takipçi satın al tiktok beğeni satın al tiktok izlenme satın al beğeni satın al instagram beğeni satın al youtube abone satın al youtube izlenme satın al buyfans buy instagram followers buy instagram likes buy instagram views buy tiktok followers buy tiktok likes buy tiktok views buy twitter followers buy telegram members Buy Youtube Subscribers Buy Youtube Views Buy Youtube Likes forstalk postegro web postegro x profile viewer