toString refactor in druntime

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 28 14:32:02 PDT 2014


On Tue, 28 Oct 2014 08:37:43 -0400
Steven Schveighoffer via Digitalmars-d <digitalmars-d at puremagic.com>
wrote:

> Meta has a cost with the current compiler. It would be nice if it 
> didn't, but I have practical concerns.
i don't think that there will be alot calls to 'write[f]' anyway. i
know that CTFE is not costless (i once wrote a simple Convey's Life
sample and summoned OOM-killer with CTFE .lif parser! ;-), but this can
be compensated by adding CTFE writef use function-by-function.

> I think a few simple functions can suffice for druntime's purposes. We 
> don't need a kitchen sink function (pun intended).
ah, those famous last words... ;-) from my observations it's enough to
implement '%[+-]width[.maxlen]s' and the same for '%x'. i also added
codes to skip arguments and to print all what's left ('%*'). i'm sure
that it can be done in <10KB, and it will be very handy to have.
druntime doesn't do alot of printing and string conversions anyway. and
phobos is already ridden with templates and CTFE.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141028/7e15c180/attachment.sig>


More information about the Digitalmars-d mailing list