6 days ago
On Friday, 31 July 2020 at 13:01:37 UTC, Adam D. Ruppe wrote:
> On Friday, 31 July 2020 at 09:10:44 UTC, Chad Joan wrote:
>> Whenever this is used, it does abandon the original zero-allocation-conversion-to-string feature, but "toString" never had that to begin with (at least not in the general case; just for static strings and such).
>
> kinda a site node but be aware there are toString overloads that do offer this.
>
> see this for example: https://github.com/dlang/druntime/blob/master/src/object.d#L1995

That's good to know. Thanks for mentioning that!
6 days ago
On Friday, 31 July 2020 at 13:48:37 UTC, Paul Backus wrote:
> On Friday, 31 July 2020 at 09:10:44 UTC, Chad Joan wrote:
>>
>> I am considering putting a "stringize" method in my types, with a signature (by convention) like so:
>> @nogc nothrow void stringize(return scope StringVacuum writer) { ... }
>>
>
> Are you aware that toString already supports this kind of overload?
>
> The documentation for it is under `std.format.formatValue`, so it is a bit easy to miss:
>
> https://dlang.org/phobos/std_format.html#.formatValue

I was not. That's good to know. This one even accepts an OutputRange. Cool.

Thanks!
Next ›   Last »
1 2 3 4 5