Refactoring a "simple" function in dmd source

Walter Bright newshound2 at digitalmars.com
Sun Dec 31 18:53:06 UTC 2023


On 12/31/2023 3:07 AM, Johan wrote:
> Nice. Even better if you'd have used std.string.splitLines !
> That would have solved your point 9; self-contained == not maintained (as proven 
> by the long standing Unicode line ending bug).

std.string.splitLines() unnecessarily allocates memory, to fix that requires 
changing its interface. Therefore, an improved version would be a candidate for 
Phobos 3.

I suspect there's a fair amount of memory allocation in Phobos that wouldn't be 
needed if we changed our point of view.



More information about the Digitalmars-d mailing list