GCs in the news

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 17 11:17:23 PDT 2014


On Thu, Jul 17, 2014 at 05:58:14PM +0000, Chris via Digitalmars-d wrote:
> On Thursday, 17 July 2014 at 17:49:24 UTC, H. S. Teoh via Digitalmars-d
> wrote:
[...]
> >AFAIK some work still needs to be done with std.string; Walter for
> >one has started some work to implement range-based equivalents for
> >std.string functions, which would be non-allocating; we just need a
> >bit of work to push things through.
> >
> >DMD 2.066 will have @nogc, which will make it easy to discover which
> >remaining parts of Phobos are still not GC-free. Then we'll know
> >where to direct our efforts. :-)
> >
> >
> >T
> 
> That's good news! See, we're getting there, just bear with us. This
> begs the question of course, how will this affect existing code? My
> code is string intensive.

I don't think it will affect existing code (esp. given Walter's stance
on breaking changes!). Probably the old GC-based string functions will
still be around for backwards-compatibility. Perhaps some of them might
be replaced with non-GC versions where it can be done transparently, but
I'd expect you'd need to rewrite your string code to take advantage of
the new range-based stuff. Hopefully the rewrites will be minimal (e.g.,
pass in an output range as argument instead of getting a returned
string, replace allocation-based code with a UFCS chain, etc.). The
ideal scenario may very well be as simple as tacking on
`.copy(myBuffer)` at the end of a UFCS chain. :-P


T

-- 
Genius may have its limitations, but stupidity is not thus handicapped. -- Elbert Hubbard


More information about the Digitalmars-d mailing list