Deprecating Allocating Functions In std.string

Jack Stouffer via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 4 15:28:07 PST 2015


On Wednesday, 4 November 2015 at 22:42:19 UTC, Jonathan M Davis 
wrote:
> And why break the code that uses them? They work just fine, and 
> for many programs, the allocation is a non-issue and simply 
> getting a string back rather than a range is more user-friendly.

Because there are two functions that do the exact same thing that 
both need to be maintained. The fix for an existing code base is 
as simple as a global find and replace for the function name and 
change the type to auto.

> And it's not like we're ever going to remove all of the 
> GC-allocating stuff from Phobos anyway.

We can remove as much as possible.

> And if we have an eager function that allocates and a lazy one 
> which doesn't, we've provided the @nogc option for that 
> functionality already.

Again, I fail to see why you would ever need to use the 
allocating versions of these functions when the non-allocating 
versions perform the exact same tasks but faster.


More information about the Digitalmars-d mailing list