Thread overview
Getting whether it's Tango or Phobos
May 19, 2008
Robert Fraser
May 19, 2008
Bill Baxter
May 19, 2008
Robert Fraser
May 19, 2008
Bill Baxter
May 20, 2008
Sean Kelly
May 20, 2008
Chris R. Miller
May 20, 2008
Sean Kelly
May 20, 2008
Mike Parker
May 19, 2008
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...?
May 19, 2008
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
May 19, 2008
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.
May 19, 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.

But it's part of the standard Tango install/setup procedure.  If you follow the instructions for how to install Tango, then you will always have -version=Tango set when using Tango.  Are you worried about the case where someone has not followed Tango's install procedures properly?

--bb
May 20, 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.

Tango actually requires that version=Tango be set for the installation to be considered complete.  I suppose we could enforce this by adding a static failure condition to Tango's object.d file, but I'd like to think that making it a default part of the bundled Tango installs and documenting the requirement in our manual install docs would be sufficient.


Sean
May 20, 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 installation.
May 20, 2008
Sean Kelly wrote:
> Robert Fraser wrote:
>> 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.
> 
> Tango actually requires that version=Tango be set for the installation to be considered complete.  I suppose we could enforce this by adding a static failure condition to Tango's object.d file, but I'd like to think that making it a default part of the bundled Tango installs and documenting the requirement in our manual install docs would be sufficient.

I also wonder how that would behave with Tangobos, which could cause issues with Phobos code expecting a version=Phobos, which would conflict with version=Tango.  Perhaps I'm wrong, but that could present a problem.



May 20, 2008
Chris R. Miller wrote:
> Sean Kelly wrote:
>> Robert Fraser wrote:
>>> 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.
>>
>> Tango actually requires that version=Tango be set for the installation to be considered complete.  I suppose we could enforce this by adding a static failure condition to Tango's object.d file, but I'd like to think that making it a default part of the bundled Tango installs and documenting the requirement in our manual install docs would be sufficient.
> 
> I also wonder how that would behave with Tangobos, which could cause issues with Phobos code expecting a version=Phobos, which would conflict with version=Tango.  Perhaps I'm wrong, but that could present a problem.

I'd probably still set version=Tango in that instance, but the user could probably set either or both safely, depending on how third party libraries are implemented.


Sean