Due to potential new direction of D, I’m looking for some escape route just in case. I’m primarily a gamedev, so no functional programming languages like Rust or Haskell. Also one of the features I dislike the most in C/C++ is the super slow and super obsolete precompiler with its header files, so no zig, I don’t want to open two files for editing the same class/struct. Memory safety is nice to have, but not a requirement, at worst case scenario I’ll just create struct SafeArray<Type>. Also I need optional OOP features instead of reinventing OOP with all kinds of hacks many do when I would need it.

Yes I know about OpenD, and could be a candidate for such things, just looking into alternatives.

    • Ephera@lemmy.ml
      link
      fedilink
      arrow-up
      27
      arrow-down
      1
      ·
      3 months ago

      Yeah, it’s got some features typically found in functional languages, like first-class functions (being able to pass around functions like values) and various list functions, e.g. .map(), .filter() etc., but the basic control flow is very much imperative.

        • SorteKanin@feddit.dk
          link
          fedilink
          arrow-up
          0
          arrow-down
          1
          ·
          3 months ago

          I wouldn’t even call that a functional feature, that’s just the language being based on expressions and bool having a then method. It’s more object-oriented in that sense if anything tbh

        • Ephera@lemmy.ml
          link
          fedilink
          arrow-up
          44
          arrow-down
          1
          ·
          3 months ago

          Right. 😅

          Apparently, we’re on different pages in this regard, but to me these are less functional language features and more just modern language features.

          In my not-so-humble opinion, it was never a good idea to make everything mutable by default. It adds so much mental overhead to try to keep track of where your state could be getting modified, especially in multi-threaded scenarios.
          We just didn’t have the type system expertise and compiler technology to enforce it without runtime overhead. Now that we have that, I don’t think any full-fledged programming language should be released with everything mutable by default.

          • ZILtoid1991@lemmy.worldOP
            link
            fedilink
            arrow-up
            2
            arrow-down
            11
            ·
            3 months ago

            I only had a bug once from unintended data mutation. In a GUI setting nonetheless, where state mutability is a must. The fix and tracking down the bug took 2-3 hours at max. No thanks, I’ll be staying with datastruct.nextState() rather than const nextState = prevState.nextState() (which is even harder to from the inside), or even worse, passing around global states in a function argument at an attempt of having a program state, which is essential for gaming. You know, games are famous for having interactibility, and not just about walking around in a static world (which is allegedly a thing for the few Rust games).

            • calcopiritus@lemmy.world
              link
              fedilink
              arrow-up
              18
              ·
              3 months ago

              You can just. Have datastruct be mutable if you want. Immutable by default doesn’t mean you can’t make variables mutable.

            • Ephera@lemmy.ml
              link
              fedilink
              arrow-up
              8
              arrow-down
              1
              ·
              edit-2
              3 months ago

              How many bugs you encounter is unfortunately not a good metric, because devs will compensate by just thinking harder. The goal is rather to not need to think as hard, which increases productivity and helps out your team members (including your future self).

              It took me a few months of working in an immutable-by-default language before I had the epiphany that everything is exactly like it’s written down in code (so long as it’s not marked as mutable). I don’t need to look at each variable and think about whether it might get changed somewhere down the line. A whole section of my brain just switched off that day.

              As the other person said, there’s also nothing stopping you from using mutability, it’s just not the default, because most variables simply don’t get mutated, even in C code.
              But I would even go so far that Rust is actually making mutability fashionable again. It has introduced various new concepts in this regard, which you won’t know from other languages.

              For example, you can opt a variable into mutability, make your changes and then opt out of it again.
              And if a function wants to modify one of its parameters, you have to explicitly pass a mutable reference, which is visible both in the function signature and where you’re calling the function.

              But perhaps most importantly, it blocks you from mutating variables that you’ve passed into a different thread (unless you wrap the value in a mutex or similar).
              In most of the immutable languages up until this point, the immutability was achieved by always copying memory when you want to change it, which is insanely inefficient. Rust doesn’t need this, by instead requiring that you follow its ownership/borrowing rules.

              Edit:
              I also don’t know what you heard, but this is for example written in Rust: https://bevyengine.org/examples/3d-rendering/bloom-3d/
              The code is right below. It uses lots of mutability…