1. 18
  1.  

  2. 6

    Very zig-like.

    1. 6

      For those Googling zig: https://ziglang.org

      1. 6

        I found this very convincing: http://tiehuis.github.io/iterative-replacement-of-c-with-zig

        C will likely never go away, but it may be tech like this that makes it bearable in the future.

    2. 5

      Huh - this might be enough to make me give D a serious shot. Having to write binding code for something that’s roughly at the same level (i.e. its a low-level language, not a scripting layer - which I don’t mind writing bindings for) always seemed odd for me.

      I write C++ like C anyway without much use of templates, so this would work perfectly for me.

      1. 4

        I wonder how do they plan on handling templates. The reason that D’s interoperability with C++ is incomplete is that you would basically need a full C++ compiler to handle templates, so I really am curious to learn how does this work around that requirement.

        I understand that this is actually using a full C++ compiler (llvm), but even so, how is the result going to be turned into D templates?

        1. 3

          I have some ideas about how to handle templates. D can link to C++ template functions and member functions, but needs a C++ source file to instantiate them and a C++ compiler to generate the binary to link to.

          The easiest way is to leave it to the user, but that’s not very ergonomic. So I’m thinking of, at the very least, trying to figure out all instantiations that happen in a .dpp file and automatically generating a C++ source file that should be compiled that the rest of the program can link to.

          I’m not sure yet. I won’t be until I try.

          1. 1

            I wonder how do they plan on handling templates.

            Probably not at all? Templates are not a C feature.

            1. 1

              Please read the article until the end. C++ support is planned.

              1. 4

                My apologies. That is an ambitious goal.

                Looking around the dpp codebase (which is impressively small!) it doesn’t look as though template work has started yet, although I did find official docs that seem to indicate D already has some support for C++ templates. I’m not sure how much complexity it tolerates.

                1. 3

                  I take the “impressively small” comment as a compliment both to the D language and to myself! :)

          2. 3

            Author here, AMA. I didn’t post on here before because I didn’t have an invite to lobte.rs.