Beehaw
  • Communities
  • Create Post
  • search
    Search
  • Login
  • Sign Up
 azdle   ( @azdle@news.idlestate.org )  to Rust@programming.devEnglish · 4 months ago

things rust shipped without (2015)

graydon2.dreamwidth.org

external-link
message-square
20
link
fedilink
25
external-link

things rust shipped without (2015)

graydon2.dreamwidth.org

 azdle   ( @azdle@news.idlestate.org )  to Rust@programming.devEnglish · 4 months ago
message-square
20
link
fedilink
Captcha Check
graydon2.dreamwidth.org
external-link
  •  soc   ( @soc@programming.dev ) 
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    4 months ago

    I don’t think the alternative to let-else is too bad.

    •  TehPers   ( @TehPers@beehaw.org ) 
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 months ago

      That’s not an alternative, it’s removing let-else entirely. It’s equivalent to this:

      let i = if let Some(i) = opt_number {
          i
      } else {
          return 0;
      };
      

      let-else is specifically a feature that allows you to use a refutable pattern to deconstruct a value by providing a diverging else branch.

      •  soc   ( @soc@programming.dev ) 
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        4 months ago

        Removing let-else is the whole point of the linked article series:

        Being able to do to everything Rust does, but without Rust’s zoo of if-then-else, match, if-let, let-else etc.

Rust@programming.dev

rust@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !rust@programming.dev

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits
  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 12 users / day
  • 64 users / week
  • 393 users / month
  • 872 users / 6 months
  • 115 local subscribers
  • 7.65K subscribers
  • 1.06K Posts
  • 3.19K Comments
  • Modlog
  • mods:
  •  snowe   ( @snowe@programming.dev ) 
  •  Ategon   ( @Ategon@programming.dev ) 
  •  EdTheLegendary   ( @EdTheLegendary@programming.dev ) 
  •  kahnclusions   ( @kahnclusions@programming.dev ) 
  •  torcherist   ( @torcherist@programming.dev ) 
  • BE: 0.19.13
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code