Getting whether it's Tango or Phobos

Mike Parker aldacron at
Mon May 19 21:12:13 PDT 2008

Robert Fraser wrote:
> Bill Baxter wrote:
>> Robert Fraser wrote:
>>> Is there a reliable way to deduce whether the user is using Tango or 
>>> Phobos? I used to use:
>>> static if(is(typeof(object.toUtf8)))
>>> But since that got changed to toString that doesn't work right now. 
>>> For the time being, I can verify it's D1 and then use (with Tango 
>>> 0.99.6)
>>> static if(!is(typeof(string)))
>>> But I'm guessing Tango may be given a string type soon...?
>> version(Tango) { ... } else { ... }  ?
>> --bb
> That requires the user to specify -version=Tango . I'm looking for 
> something that can be compiled with either Tango or Phobos without 
> asking anything of the user.

I've been using this in Derelict for a long while now with no complaints 
and I know it's used in other libraries. Any one who doesn't have 
version=Tango defined when using Tango will find himself with a broken 

More information about the Digitalmars-d-learn mailing list