Wiki Navigation

tangobos

Tangobos is a port of Phobos (the D standard library) to the Tango runtime, allowing most Phobos software to be compiled unmodified with Tango. In practice only the lowest-level parts of Phobos needed any porting at all -- the majority of Tangobos modules are unmodified copies of the original Phobos sources.

Project Status

Purpose

Tango and Phobos are, by default, incompatible due to their different implementations of core system functions like the garbage collector, IO, and threading. It has been announced that Tango and Phobos will be gradually moving towards some form of compatibility; but in the mean time, Tangobos was created out of a realistic view of the scenario to allow people to mix and match code from both libraries today. Tangobos is neither part of Tango nor supported or affiliated with the Tango team, though the Tango team has graciously started providing versions of Tango with Tangobos bundled-in.

The two major use cases for Tangobos envisioned by its creator are:

1. Porting code.

Porting code from one standard library to another is difficult enough. It's even more difficult when you can't have any level of interaction: In that case, the port must be all-at-once. An iterative port allows for debugging of individual changes, which makes the whole porting process easier.

2. Legacy libraries.

It makes no sense to maintain a fork of a perfectly-usable but Phobos-oriented code base. Ideally, it will eventually be converted to Tango, but in the interim, tangobos may be the best solution.

Usage

First, to use the tangobos compatibility, you must import something from the std.* hierarchy. If nothing else at least import std.compat to get needed aliases for 'string' and 'Error' which Tango omits. This is a Tangobos-only module so it should be imported like so:

version(Tango) import std.compat;

Second, some low-level modules are not fully ported. In general, the porting effort from Phobos to Tangobos for code using such modules is minimal since the low-level interfaces of the two libraries are similar. A wrapper module exists for std.gc, for example, so most code using std.gc should still work. If anything is going to cause trouble it will probably be code that makes heavy use of std.thread. It is the one module that is indeed a compatibility wrapper around Tango functionality. Tango and Phobos have fairly different threading models, so the API mapping is not 1-to-1 exactly.

Updates

Tangobos is at the latest version of Phobos that compiles with GDC. Gregor Richards will update it further with the next release of GDC.

Bundled with Tango

In order to use Tangobos on Linux, the bin/dmd.conf file must be modified. Specificially, "\..\import\tangobos" must be changed to "/../import/tangobos". Can someone please fix this in the download itself?