Garbage collection, and practical strategies to avoid allocation

Brad Anderson eco at gnuk.net
Fri May 31 21:53:49 PDT 2013


On Saturday, 1 June 2013 at 04:16:44 UTC, Jonathan M Davis wrote:
> [snip]
> The situation is even
> worse with narrow strings (assuming that put works with them - 
> I'm not sure
> that it does at the moment) given that even if you knew their 
> length (which
> you wouldn't if you were going by hasLength), you wouldn't know 
> whether a put
> would succeed when the string was nearly empty, as the actual 
> number of
> elements that the dchar would take up would depend on its value.


Furthermore--you probably know this because of the conversation 
on GitHub but for anyone else reading--narrow strings are also 
hard to work with because you can't put a dchar on them 
currently. Kenji had a pull request (since closed) to help with 
narrow strings issues:

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

That and all the issues and unknowns you describe would need to 
fixed for output ranges are going to be the approach.

I'm reminded of a forum post by monarch_dodra that talked about 
some of the issues you brought up: 
http://forum.dlang.org/thread/xyvnifnetythvrhtcexm@forum.dlang.org


More information about the Digitalmars-d mailing list