Does the D language have multiple standard libraries and issues with GC?

后端 未结 6 737
猫巷女王i
猫巷女王i 2021-02-02 06:33

I\'m wondering how mature and stable D is, and if it might be a good replacement for C/C++.

I know that there are currently two standard libraries (Phobos and Tango). Is

6条回答
  •  生来不讨喜
    2021-02-02 06:42

    I know that there are currently two standard libraries (Phobos and Tango), so I assume that there might be people trying to unify them.

    "Unification" is extremely unlikely due to differences in licenses. When Tango will be ported to D 2.0, you will be able to use it alongside Phobos, which isn't (easily) possible in D 1.0.

    Additionally I heard some time ago that the languages has problems on the boundaries of GCed/non-GCed code. I couldn't find any reference about that on the D website, so is this problem still true?

    I believe there are only problems if you're not careful with how you manage memory. If all references to a GC-allocated object is stored outside the memory regions marked as GC roots, the GC will consider the object unreferenced and will delete it.

    If I had to choose D as a C replacement today, what D (v 1.0 or v 2.0) and what standard library would you suggest?

    Phobos and Tango are going in somewhat different directions. Phobos (in D 2.0) ties in closely with D2's new features. Tango is more feature-packed, and contains modules which aren't present in Phobos, e.g. HTTP/FTP client support, various cryptography classes, etc. They also follow different design philosophies (Phobos is more imperative/meta-programming-ish, while Tango is very strictly OOP-like, and thus similar to Java in that regard).

提交回复
热议问题