Last update March 7, 2012

Standard Lib



When beginning to learn D one comes across the need to learn a lot about what is happening in its development to really understand what they should be looking at. One aspect that is probably the strangest for new comers is the competing runtime libraries: Phobos and Tango. Note that there really is only one standard library, which is Phobos.

Table of contents of this page
The Situation   
Misconceptions   
The Coming of Tango   
Resolution   
Suggested Resolutions   

The Situation    

When it comes to development, the community is split over two choices. There are some historical reasons for this. This separation has caused conflicts within the community, but even worse is confusion for those that have just arrived.

Phobos is the original and first library for D developed and maintained by Walter Bright. This library is developed in a way that feels similar to the C libraries. The library has been placed onto DSource for community input, while having Walter decide what changes will be added to the release bundle.

Tango started in 2006 as a runtime library to replace Phobos. This library has more of a C++ feeling as it uses streams for standard io and many objects will return themselves for chaining. Tango has had some misconceptions relating to its design. It has been gaining more popularity as more projects are created using Tango, and older Phobos projects are moved to a Tango code base.

Misconceptions    

There have been some misunderstandings about Tango that people seem to make when looking into whether they should use it.

  • Tango is solely class based
This is not the case, it uses classes where appropriate such as the stream object for output.
  • Tango is for large projects and not system level coding
This can be true if you want it to be, however it was designed with layers allowing one to use only the basics if that is all that is needed.
  • Tango only knows one dance
It knows only one style of dance, but it knows more than one dance.

The Coming of Tango    

A lot has changed over the few years Tango has been around and many people do not understand why Tango was created, and why it didn't just build off of the Standard library. As D was picking up more community members, one of the things that was bugging a lot of users was the slow movement of Phobos. It wasn't moving in any direction, useful features were missing and no one could easily provide code (or didn't feel as though they could).

To resolve the problem of movement the Ares project was started, the second coming of Phobos. This never got much momentum and the reason I will give is that it felt like Phobos. There wasn't much benefit to switch as there was still a need to have it expanded.

Ares declared defeat after Tango made itself known. There were good reasons Tango has survived. There is a great development crew working on it. It has had a greatly different design from Phobos letting others see it as an alternative rather than an extension.

There are at least two reasons that Tango was not built on top of Phobos. One is the differences in what its goal was as a library. Phobos has a lot of interdependence while Tango wished to use the layered scheme. It also was going to be expanding functionality, it would not be good to add on top of Phobos an then later have to remove something when it was later added to Phobos.

Resolution    

There will be no changes to the situation for D1. However D2, as of version 2.020, has had Phobos split into 2 libraries, druntime.lib and phobos.lib. This is to allow a common runtime to be used with both Phobos and Tango. While there is no plan to merge both libraries or even include Tango with releases of DMD, this will allow both libraries to be used at the same time without a compatibility layer.

Suggested Resolutions    


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: March 7, 2012 20:34 (diff))