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;" everything compiles and works.

Since the docs of std.format contains all the format specifier description etc. I would expect that only including "std.format" should be enough.

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 in this PR:

https://github.com/D-Programming-Language/phobos/pull/2732

It will be available in 2.067, soon to be released.

Reply via email to