digitalmars.D.learn - Getting whether it's Tango or Phobos
- Robert Fraser (7/7) May 19 2008 Is there a reliable way to deduce whether the user is using Tango or
- Bill Baxter (3/14) May 19 2008 version(Tango) { ... } else { ... } ?
- Robert Fraser (4/20) May 19 2008 That requires the user to specify -version=Tango . I'm looking for
- Bill Baxter (6/28) May 19 2008 But it's part of the standard Tango install/setup procedure. If you
- Sean Kelly (7/29) May 19 2008 Tango actually requires that version=Tango be set for the installation
- Chris R. Miller (10/20) May 19 2008 =20
- Sean Kelly (5/21) May 19 2008 I'd probably still set version=Tango in that instance, but the user
- Mike Parker (5/27) May 19 2008 I've been using this in Derelict for a long while now with no complaints...
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: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.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
Robert Fraser wrote:Bill Baxter wrote: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? --bbRobert 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.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
Robert Fraser wrote:Bill Baxter wrote: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. SeanRobert 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.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
Sean Kelly wrote:Robert Fraser wrote:n=20That requires the user to specify -version=3DTango . I'm looking for=20 something that can be compiled with either Tango or Phobos without=20 asking anything of the user.=20 Tango actually requires that version=3DTango be set for the installatio=to be considered complete. I suppose we could enforce this by adding a==20static failure condition to Tango's object.d file, but I'd like to thin=k=20that making it a default part of the bundled Tango installs and=20 documenting the requirement in our manual install docs would be suffici=ent. I also wonder how that would behave with Tangobos, which could cause=20 issues with Phobos code expecting a version=3DPhobos, which would conflic= t=20 with version=3DTango. Perhaps I'm wrong, but that could present a proble= m.
May 19 2008
Chris R. Miller wrote:Sean Kelly wrote: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. SeanRobert Fraser wrote: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.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.
May 19 2008
Robert Fraser wrote:Bill Baxter wrote: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.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.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