UmU
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
cm0002@lemmy.world to Programmer Humor@programming.dev · 2 months ago

What's stopping you from writing your Rust like this?

lemmy.ml

message-square
61
fedilink
  • cross-posted to:
  • [email protected]
412

What's stopping you from writing your Rust like this?

lemmy.ml

cm0002@lemmy.world to Programmer Humor@programming.dev · 2 months ago
message-square
61
fedilink
  • cross-posted to:
  • [email protected]
alert-triangle
You must log in or register to comment.
  • parlaptie@feddit.org
    link
    fedilink
    arrow-up
    146
    ·
    2 months ago

    Hang on, this is just a C++ joke slapped onto Rust.

    • puchaczyk@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      148
      ·
      2 months ago

      You could say they have rewritten the joke in Rust

      • dave@feddit.uk
        link
        fedilink
        English
        arrow-up
        18
        ·
        2 months ago

        But you get the joke faster now.

        • Log in | Sign up@lemmy.world
          link
          fedilink
          arrow-up
          8
          ·
          2 months ago

          No, it’s just impossible for it to leak out of a hole in the back of your head that you didn’t realise was growing under your pony tail.

  • Laser@feddit.org
    link
    fedilink
    arrow-up
    92
    ·
    2 months ago

    • enemenemu@lemm.ee
      link
      fedilink
      arrow-up
      15
      ·
      2 months ago

      To me it just looks like you do not need the braces at all

    • merc@sh.itjust.works
      link
      fedilink
      arrow-up
      5
      ·
      2 months ago

      A funny, but incredibly subtle joke to do would be to do a post like this, but get the indentation subtly wrong somewhere, so something that’s supposed to be inside a loop is outside according to indentation, but is inside according to braces.

  • duckythescientist@sh.itjust.works
    link
    fedilink
    arrow-up
    84
    ·
    2 months ago

    I’m good at Python, and I don’t know Rust. This looks fine to me. I’ve fully missed the joke.

    • Logi@lemmy.world
      link
      fedilink
      arrow-up
      169
      ·
      edit-2
      2 months ago

      Same. Until you notice the column of curly braces and semi colons in the right margin.

      • ryannathans@aussie.zone
        link
        fedilink
        arrow-up
        48
        ·
        2 months ago

        Lgtm ship it to prod

        • Viking_Hippie@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          22
          ·
          2 months ago

          Lgtm? Let’s go to Madrid?

          • zlatko@programming.dev
            link
            fedilink
            arrow-up
            13
            ·
            2 months ago

            You never review code when you have no time to do an actual review? Looks good to me :)

            • Viking_Hippie@lemmy.dbzer0.com
              link
              fedilink
              arrow-up
              6
              ·
              2 months ago

              You never review code when you have no time to do an actual review?

              Nope. Then again, I never review code at all 🤷😁

              • Mose13@lemmy.world
                link
                fedilink
                arrow-up
                8
                ·
                2 months ago

                Don’t review, don’t write tests, and don’t even do QA. All of those tasks are overhead. It’s time you could be spending completing more story points. All that matters is story points, not the customer, not your coworkers, not your happiness, not your sanity. Just story points.

            • merc@sh.itjust.works
              link
              fedilink
              arrow-up
              2
              ·
              2 months ago

              LGTM: Large Glitches, Test More!

        • AtariDump@lemmy.world
          link
          fedilink
          arrow-up
          6
          ·
          2 months ago

      • Arcka@midwest.social
        link
        fedilink
        English
        arrow-up
        23
        ·
        2 months ago

        Oh, so Rust is like JavaScript!

        • barsoap@lemm.ee
          link
          fedilink
          arrow-up
          7
          ·
          2 months ago

          No, Rust lacks the semicolon elision rules of Javascript which make everyone always use semicolons in javascript because they’re so horribly broken.

          Rust is like ML, quite literally, not just by ancestry: The syntax is palpably ugly, but at least it’s sane, regular, and concise where it matters.

        • F04118F@feddit.nl
          link
          fedilink
          arrow-up
          3
          ·
          2 months ago

          Undervalued comment right there. This is better than the OP

        • 🇦🇺𝕄𝕦𝕟𝕥𝕖𝕕𝕔𝕣𝕠𝕔𝕕𝕚𝕝𝕖@lemm.ee
          link
          fedilink
          English
          arrow-up
          1
          ·
          2 months ago

          Pretty sure javascript is like c but I I can’t be mad at the js devs for the awful language they write.

      • duckythescientist@sh.itjust.works
        link
        fedilink
        arrow-up
        9
        ·
        2 months ago

        Oh… Oh god

  • Dave.@aussie.zone
    link
    fedilink
    arrow-up
    72
    ·
    edit-2
    2 months ago

    rustfmt

    is stopping me from writing code like this, and I have never been more happier using it after viewing this.

    • killeronthecorner@lemmy.world
      link
      fedilink
      English
      arrow-up
      62
      ·
      2 months ago

      I’m going to write a tool that automatically adds the braces and semicolons to the column as you edit the code.

      I will call it rustfml

      • irelephant [he/him]🍭@lemm.ee
        link
        fedilink
        English
        arrow-up
        11
        ·
        2 months ago

        Crap, thats what I was thinking.

        • verstra@programming.dev
          link
          fedilink
          arrow-up
          10
          ·
          2 months ago

          It could be run after git checkout and then rustfmt before commit.

          • killeronthecorner@lemmy.world
            link
            fedilink
            English
            arrow-up
            5
            ·
            2 months ago

            Slow down satan

      • nintendiator@feddit.cl
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 months ago

        Please do, I’m waiting for it to get ported to other languages.

  • TheAgeOfSuperboredom@lemmy.ca
    link
    fedilink
    arrow-up
    60
    ·
    2 months ago

    Then some jerk runs rustfmt and ruins all your hard work!

    • wise_pancake@lemmy.ca
      link
      fedilink
      arrow-up
      30
      ·
      2 months ago

      Can’t you fix the default format to this?

  • Feathercrown@lemmy.world
    link
    fedilink
    English
    arrow-up
    51
    ·
    2 months ago

    It took me way too long to notice the horror on the right

    • Rusty Shackleford@programming.dev
      link
      fedilink
      English
      arrow-up
      9
      ·
      2 months ago

      My eyes!

  • mostlikelyaperson@lemmy.world
    link
    fedilink
    arrow-up
    34
    ·
    2 months ago

    My medication mostly.

  • PhobosAnomaly@feddit.uk
    link
    fedilink
    arrow-up
    30
    ·
    2 months ago

    I hate it with every fibre of my being but also secretly calmed by that column of statement terminators and brackets.

    It’s like the code representation of the Vancouver riots kiss photo.

    • Lena@gregtech.eu
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 months ago

      Why would that cause the same feeling?

      • PhobosAnomaly@feddit.uk
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        2 months ago

        I’m not sure if you’re taking the piss or not but I’m going to choose to believe you’re asking in good faith!

        The code just feels… messy, unfamiliar, almost chaotic - but the semicolons and curly brackets in a neat little row, formatted in a satisfying way, is like an island of calm and order in the middle of a formatting clusterfuck.

        A moment of serenity in the middle of a riot, one may think.

        • Lena@gregtech.eu
          link
          fedilink
          English
          arrow-up
          3
          ·
          2 months ago

          Ohhhh thanks for the explanation, I’m a bit stupid :3

          Also, I didn’t mean it in a bad way, a genuine question. Thanks for assuming it’s in good faith ^^

  • notabot@lemm.ee
    link
    fedilink
    arrow-up
    18
    ·
    2 months ago

    This makes my deeply uncomfortable, like an itch I can’t quite scratch.

    • bitcrafter@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      2 months ago

      More like a scratch you just can’t itch.

  • villainy@lemmy.world
    link
    fedilink
    arrow-up
    14
    ·
    2 months ago

    DwangoAC and the TASBot crew are maniacs in the best possible way. I would like to continue having a high opinion of him, hence I will pretend that this post does not exist.

  • CanadaPlus@lemmy.sdf.org
    link
    fedilink
    arrow-up
    11
    ·
    2 months ago

    Wow, so this is possible.

    Formatting is so damn arbitrary. Somebody has to have tried storing just the parse tree on disk, right?

    • Lightfire228@pawb.social
      link
      fedilink
      arrow-up
      2
      ·
      2 months ago

      If you do that, you lose formatting and comments every time you load the source from disk

      • CanadaPlus@lemmy.sdf.org
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        2 months ago

        Losing formatting other than what you’ve set in your deparser would be the point. Losing comments would be bad, but that seems easily fixable just by giving each comment block a symbol that points to it’s contents.

        • djehuti@programming.dev
          link
          fedilink
          arrow-up
          3
          ·
          2 months ago

          Or by including comments in the parse tree. (& Yes, it is done various places for various languages and formats.)

          • CanadaPlus@lemmy.sdf.org
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            2 months ago

            Do you have some examples?

            (That is what I meant by giving them a symbol, maybe I worded it poorly)

            • djehuti@programming.dev
              link
              fedilink
              arrow-up
              1
              ·
              2 months ago

              The best example I have is a closed source one and I can’t be more specific on what it is than to say that it’s probably installed on at least one of your Apple devices (assuming you have any).

              Implementation-wise, the syntax tree nodes have additional attributes that hold pre- and/or post-element text. What’s on disk is the serialized tree. You edit a text version, and it’s parsed on every edit so it doesn’t have to be parsed again at evaluation time, and what’s stored is the parse tree with enough whitespace and comment hints to reconstruct the text for editing.

              This is a case where looking at the textual code is rare, but hundreds of results must get updated in realtime on every change. This might be enough of a hint as to what program it is.

    • brisk@aussie.zone
      link
      fedilink
      arrow-up
      2
      ·
      2 months ago

      The closest thing I’ve seen is Combobulate

  • mariusafa@lemmy.sdf.org
    link
    fedilink
    arrow-up
    10
    ·
    2 months ago

    This is why python has to be putdown

    • Reptorian@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      I dislike Python as well, but it has it place. I only use it for quick code tests before doing it in other languages.

  • poireCartable@lemm.ee
    link
    fedilink
    arrow-up
    10
    ·
    2 months ago

    My eyes! My eyes!!!

  • Stefen Auris@pawb.social
    link
    fedilink
    English
    arrow-up
    9
    ·
    2 months ago

    Sanity

  • Tony Bark@pawb.social
    link
    fedilink
    English
    arrow-up
    9
    ·
    2 months ago

    Oh… Oh! Well, that is creative.

Programmer Humor@programming.dev

programmer_humor@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: [email protected]

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

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

  • 1.58K users / day
  • 4.55K users / week
  • 9.04K users / month
  • 17.3K users / 6 months
  • 2 local subscribers
  • 23.1K subscribers
  • 1.25K Posts
  • 39.3K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.9
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org