Phobos/Tango Unification Plans

Bruno Medeiros brunodomedeiros+spam at com.gmail
Thu Oct 16 10:14:34 PDT 2008


Don wrote:
> Benji Smith wrote:
>> I was just looking through bearophile's library (which is based on 
>> Phobos) and thinking about how it's too bad that I can't use it 
>> because my code is all based on Tango.
>>
>> I know there are plans currently in the works to implement a 
>> compatible runtime layer, via Sean's druntime project. And it'll be a 
>> breath of fresh air to get rid of the basic incompatibilities in the 
>> two runtimes.
>>
>> But if that's all that happens, it'll still leave an undesirable 
>> situation, since all the other userland stuff will be incompatible.
>>
>> Eventually, any significantly complex project is likely to have some 
>> dependent libraries built on top of both Phobos and Tango. At the very 
>> least, string-processing routines from both libraries will get 
>> compiled into the final executable.
>>
>> Not only will that result in duplication of functionality (and code 
>> bloat), but it'll also mean a bunch of bit-twiddling whenever sending 
>> a Tango type into a Phobos-dependent library function (and vice versa).
>>
>> Are there any plans in the works to mitigate that problem? Like, 
>> perhaps, negotiating a common API so that at least the names and 
>> argument types are the same in both libraries?
>>
>> I'm sure the two libraries will always include different subsets of 
>> functionality, but whenever they implement the same basic features, 
>> it'd be great if they used a compatible API.
>>
>> --benji
> 
> 
> That could have some difficult aspects, but here's an uncomplicated 
> second step: The math libraries for Tango and Phobos aren't merely 
> compatible, they are THE SAME! They are a cut-and-paste of each other, 
> with a couple of trivial name changes.
> There are no licensing issues or personality clashes to worry about -- 
> I've written most of both of them. They have no dependencies on anything 
> else in either Phobos or Tango. I have write access to repositories of 
> both Phobos and Tango.
> YET -- there are two bodies of code! This is absolutely ridiculous, and 
> it's driving me mad.
> 
> How can we turn this into ONE body of code?
> It will only be possible if there is a namespace which is present in 
> both Tango and Phobos. There are exactly three ways in which this can be 
> done:
> Either
> (1) Tango needs to include part of the std namespace,
> (2) Phobos needs to include part of the tango namespace, or
> (3) Both need to start including a new namespace which is common to both.
> 
> Of these options, I think (2) is the least natural. For (1) to work, the 
> modules invoved would need to be clearly designated as common.
> 
> 

I don't get it. Why is it that "For (1) to work, the modules invoved 
would need to be clearly designated as common." ? Since Tango will 
become compatible with Phobos (same runtime), can't Tango just 
use/depend-on some of Phobos functionality?


-- 
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list