• @[email protected]
      link
      fedilink
      52 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.

  • @[email protected]
    link
    fedilink
    832 months ago

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

  • @[email protected]
    link
    fedilink
    112 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?

      • @[email protected]
        link
        fedilink
        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.

        • @[email protected]
          link
          fedilink
          32 months ago

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

          • @[email protected]
            link
            fedilink
            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)

            • @[email protected]
              link
              fedilink
              12 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.

    • @[email protected]
      link
      fedilink
      12 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.

  • PhobosAnomaly
    link
    fedilink
    282 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
      link
      fedilink
      English
      12 months ago

      Why would that cause the same feeling?

      • PhobosAnomaly
        link
        fedilink
        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
          link
          fedilink
          English
          32 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 ^^

  • Dave.
    link
    fedilink
    71
    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.

  • @[email protected]
    link
    fedilink
    122 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.