On Thu, 30 Oct 2014 13:12:43 -0700 "H. S. Teoh via Digitalmars-d" <[email protected]> wrote:
> On Thu, Oct 30, 2014 at 10:03:32PM +0200, ketmar via Digitalmars-d wrote: > > On Thu, 30 Oct 2014 09:46:48 -0700 > > "H. S. Teoh via Digitalmars-d" <[email protected]> wrote: > > > > > I saw that. Do you think it might be extendible enough to replace > > > std.stdio.writef? > > > > p.s. i'm actually planning to add the things like "%?s", where "?" > > means "take width from the writef!() argument". i.e. this will be > > possible: `writef!"%?s"(8, "abc")`, and it will work like > > `writef!"%8s"("abc");`. that's why i'm using that ugly > > `wrWriteWidth()` function to do formatted write. > > std.format already supports passing the width argument as a parameter. > In fact, both the precision and the width can be used: yes, i know. but my library is not supporting that yet. and i already used "%*" as "print all unprocessed arguments", so i'm planning to utilize '?' instead of '*' (which, i believe, has it's roots in C pointer notation). > Actually, to!string doesn't always allocate, for example, if the target > type supports the toString(scope void delegate(const(char)[])) overload. yes, i know that. it was just an example. ;-) > One of my goals for the CT format string project is to modularize format > string processing, so that it actually will not reference any conversion > code that it doesn't actually use. So if you only use format strings > that don't need allocation, the resulting function should be inferrable > as @nogc. Ditto for pure, nothrow, etc.. Obviously this is impossible > for runtime format strings, since you don't know what formatting the > format string might ask for at runtime, but with compile-time known > format strings, you can easily omit all the unnecessary cases that you > know will never actually get called. yes, this will be very valuable. impossibility of using writef in @nogc functions was my motivation to create my version too. i'm not there yet, but it's slowly moving on. but i'm planning to change/extend formatting syntax too (what i have now is just a draft), that's why i don't even trying to write 'iv.writer' as possible part of Phobos. i'm fully understand that breaking formatting syntax is no-no for "std.".
signature.asc
Description: PGP signature
