I don’t need something practical. I just need something fun to keep me motivated.

  • DaPorkchop_@lemmy.ml
    link
    fedilink
    arrow-up
    6
    arrow-down
    1
    ·
    6 days ago

    This is probably an unpopular opinion, but I find modern C++ with templates and constexpr to be quite fun, mainly from the perspective of trying to do as much at compile-time as possible. Most of the resulting code is nearly incomprehensible and never gets used for anything outside of a godbolt demo, but trying to do complex tasks within the limited and unintuitive world of compile-time evaluation is something I’ve never really been able to find in any other language.

    i don’t want to hear about rust, const generics are almost useless and you know it, specialization isn’t really a thing and nothing like variadic templates exists yet

    • ageedizzle@piefed.caOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 days ago

      i don’t want to hear about rust, const generics are almost useless and you know it, specialization isn’t really a thing and nothing like variadic templates exists yet

      What is your honest opinion about Rust? I’m curious

      • DaPorkchop_@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        4 days ago

        Rust has a lot of cool ideas (I love the borrow checker), but in its current state I don’t think it can replace C++ for the things I’d be interested in using it for. 99% of the time when I reach for a natively compiled language it’s because I need to do some performance-critical loop I can’t reasonably implement in the language my business logic is written in (normally Java), and I end up in a situation where most of Rust’s advantages (and C++'s footguns) aren’t really relevant (lifetimes don’t matter if I’m just writing some SIMD code which reads/writes into externally allocated memory segments). So for my purposes, Rust is mostly just a worse version of C++ in that it’s missing a bunch of features I want (my main gripes already listed above) and has a bunch of cool features that I don’t care about.

        If I were writing an entire program from scratch I’d probably opt for Rust over C++, at least for the bulk of the business logic, but I don’t think Rust has quite achieved its ideal of “zero-cost abstraction” for many performance-critical use cases, and certainly not most of the ones I actually have.

        • ageedizzle@piefed.caOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          3 days ago

          Ok thanks. Interesting to hear that. Rust does seem really cool but i someone wonder if I’m just caught up in a hype cycle. So it’s good to hear a well measured critique like this

    • orclev@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      5 days ago

      You should check out Zig’s macro system, I think you’ll find it really interesting.