Made with KolourPaint and screenshots from Kate (with the GitHub theme).

  • pivot_root@lemmy.world
    link
    fedilink
    arrow-up
    8
    ·
    edit-2
    8 days ago

    Rust is verbose, but C++ might still take the cake with its standard library templates. Especially when using fully-qualified type names…

    auto a = ::std::make_shared<::std::basic_string<char, ::std::char_traits<char>, MyAllocator<char>>>();

    A reference-counted shared pointer to a string of unspecified character encoding and using a non-default memory allocator.

    • Justin@lemmy.jlh.name
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      7 days ago

      Yeah, I mean Rust is only verbose if you want it to be. let foo = "bar"; is valid rust too, no need to declare the type and definitely no need to declare the lifetime.

      For that matter, if you ever declare something as explicitly 'static in code that isn’t embedded or super optimized, you’re probably doing it wrong.

    • calcopiritus@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      8 days ago

      fully qualified type names make any language awful.

      Here’s the same example in rust:

      let a = std::rc::Rc::new(std::vec::Vec<u8, MyAllocator>::new());

      I believe u8 also comes from a module, so it would be something like std::u8::u8, but I’m not sure.

      • KubeRoot@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        12
        ·
        8 days ago

        Not when taken to such an extreme so as to obfuscate the meaning and behavior of code, and make it difficult to understand how you would arrive at that code.

        Sane defaults serve to reduce verbosity without obfuscating meaning, simpler syntax with different ordering and fewer tokens reduce verbosity to make the code easier to read by reducing the amount of text you have to pay attention to to understand what the result is.

        I imagine there’s also a distinction to be made between verbosity and redundancy - sometimes extra text might fail to carry information, or carry information that’s already carried elsewhere. I’m not sure where the line should be drawn, because sometimes duplicate information can be helpful, and spacing out information with technically meaningless text has value for readability, but I feel like it’s there.

        • acargitz@lemmy.ca
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          8 days ago

          Frankly, I have way more often ended up scratching my head for some cryptic piece of syntax than the opposite. Sure I could sit down and spend the rest of my life learning each language designer’s favourite syntax optimisations, but I kinda don’t want to. I’m a human, not a parser.

          And frankly, a good IDE editor should be able to fold/unfold verbose syntax. Better for it then to be there and folded, than for it to not be there and for someone to have to work backwards the intendrd meaning of every single line of code.