Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the current status of D standard libraries?

There are two of them Phobos and Tango. As far as I know they are redundant and incompatible. Are there any plans to join them? If so, when will it happen?

like image 381
Łukasz Lew Avatar asked Apr 21 '09 15:04

Łukasz Lew


People also ask

What happened if standard library is not present in C?

Without the standard library, you're entire reliant on your own code, any non-standard libraries that might be available to you, and any operating system system calls that you might be able to interface to (which might be considered non-standard library calls).

What is included in the standard library?

Standard libraries typically include definitions for commonly used algorithms, data structures, and mechanisms for input and output. Depending on the constructs made available by the host language, a standard library may include: Subroutines. Macro definitions.

What are the 3 main libraries of C++?

The Diagnostics Library. The General Utilities Library.

What are standard libraries in Python?

The Python Standard Library is a collection of script modules accessible to a Python program to simplify the programming process and removing the need to rewrite commonly used commands. They can be used by 'calling/importing' them at the beginning of a script.


1 Answers

A common core, called druntime, has been built for D2. The low-level runtime stuff, like garbage collection and threading, was previously the barrier to Phobos and Tango interoperating in the same project. Phobos's higher level functionality depended on the Phobos runtime and likewise for Tango.

A major update to Phobos has been released (just yesterday (4/20/09) as a matter of fact). This update tries to make use of some of the new features of D2 and introduces the concept of ranges, which are like iterators but easier to work with and more powerful. D2 Phobos is very different from its underpowered D1 counterpart.

Tango is by far the better standard library for D1. A D2 port is in progress, and will likely progress much more rapidly when D2 is stable. A big question is whether the Tango devs will update it to take full advantage of the D2 features, or whether they will simply focus on making it work with D2 the same way it does with D1.

Contrasting the two libraries, Phobos tends to focus more on making simple things simple, syntactic sugar, convenience and pushing the envelope of what can be done in a standard library. It's something of a cross between STL and Python's standard library, as weird as that sounds. Tango tends to have more of a Java-like feel to it. It's more focused on breadth of features and handling unusual use cases gracefully. It stays more within the sane subset of D (not as much template metaprogramming, etc., though arguably a major feature of D is to promote template metaprogramming to sane subset status), and takes a more pragmatic approach to API design.

My own guess (speculation, but it makes a lot of sense) is that Phobos will become analogous to STL, i.e. a truly standard library of core functionality, and Tango will become a utility library, kind of like Boost, as more of its core functionality is absorbed into Phobos and/or druntime.

Finally, as others noted, D1 is supposed to be stable, so nothing is changing here.

like image 171
dsimcha Avatar answered Oct 07 '22 06:10

dsimcha