Re: Using std.format required std.string?

2015-03-16 Thread ketmar via Digitalmars-d-learn
On Mon, 16 Mar 2015 12:32:01 +0100, Robert M. Münch wrote: > I prefer to move things to the "far future compatibility" path ASAP. > Reduce a lot of maintenance headaches. then you can check properties, not versions. ;-) static if (__traits(compiles, {import std.string : format;})) { import st

Re: Using std.format required std.string?

2015-03-16 Thread Robert M. Münch via Digitalmars-d-learn
On 2015-03-15 19:16:52 +, anonymous said: Answerting myself: static if (__traits(compiles, version_minor < 67)) import std.string; // format() for versions < 2.0.67 else import std.format; // format() for versions >= 2.0.67 That doesn't do what you want. You need to `import std.compiler;

Re: Using std.format required std.string?

2015-03-15 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 15 March 2015 at 17:36:24 UTC, Robert M. Münch wrote: Ok, good to here. Didn't cath/remember this one. Is there a way to use "version(...)" to have code sections depending on compiler version? Something like: version(dmd >= 2.067) or version(dmd < 2.067)? static if( __VERSION__

Re: Using std.format required std.string?

2015-03-15 Thread Mike Parker via Digitalmars-d-learn
On Monday, 16 March 2015 at 04:31:19 UTC, Mike Parker wrote: On Sunday, 15 March 2015 at 17:36:24 UTC, Robert M. Münch wrote: Ok, good to here. Didn't cath/remember this one. Is there a way to use "version(...)" to have code sections depending on compiler version? Something like: version(d

Re: Using std.format required std.string?

2015-03-15 Thread anonymous via Digitalmars-d-learn
On Sunday, 15 March 2015 at 18:03:55 UTC, Robert M. Münch wrote: On 2015-03-15 17:36:24 +, Robert M. Münch said: Is there a way to use "version(...)" to have code sections depending on compiler version? Something like: version(dmd >= 2.067) or version(dmd < 2.067)? Answerting myself: st

Re: Using std.format required std.string?

2015-03-15 Thread Robert M. Münch via Digitalmars-d-learn
On 2015-03-15 17:36:24 +, Robert M. Münch said: Is there a way to use "version(...)" to have code sections depending on compiler version? Something like: version(dmd >= 2.067) or version(dmd < 2.067)? Answerting myself: static if (__traits(compiles, version_minor < 67)) import std.strin

Re: Using std.format required std.string?

2015-03-15 Thread Robert M. Münch via Digitalmars-d-learn
On 2015-03-15 16:22:03 +, Marc Schütz said: For whatever reasons, format() used to be defined in std.string. Indeed it's unintuitive to have it there, and it also pulls in lots of other unrelated things like Unicode tables when you import std.string. That's why it was moved into std.format

Re: Using std.format required std.string?

2015-03-15 Thread via Digitalmars-d-learn
On Sunday, 15 March 2015 at 15:48:34 UTC, Robert M. Münch wrote: Hi, wondering why this happens: import std.format; void ods(T...)(auto ref T args){ format(args).ptr; return; } ods("%s @ %s", mystring, mystring.ptr); Error: undefined identifier format If I add: "import std.string;" every

Using std.format required std.string?

2015-03-15 Thread Robert M. Münch via Digitalmars-d-learn
Hi, wondering why this happens: import std.format; void ods(T...)(auto ref T args){ format(args).ptr; return; } ods("%s @ %s", mystring, mystring.ptr); Error: undefined identifier format If I add: "import std.string;" everything compiles and works. Since the docs of std.format contains a