On 5/8/14, 11:27 AM, Walter Bright wrote:
On 5/8/2014 10:46 AM, Andrei Alexandrescu wrote:
A discussion is building around
https://github.com/D-Programming-Language/phobos/pull/2149, which is a
nice
initiative by Walter to allow Phobos users to avoid or control memory
allocation.
The setExtension() function is itself not very important, but what is
important is an example for how to put together ranges.
Some design goals:
1. purity, @safe, nothrow, @nogc
2. composability
3. have them work in a consistent way, so there's less for a user to learn
4. Rule of least surprise
Some may be surprised that auto c = setExtension(a, b) doesn't actually
just do it. So changing a and/or b before using c would yield surprising
result for someone coming from a background of eager-string languages.
Andrei