On Saturday, 19 April 2014 at 10:07:46 UTC, Jacob Carlborg wrote:
On 2014-04-18 18:17, Brad Anderson wrote:

Problems like how toUpperInPlace would still allocate (with
gusto) could much more easily be recognized and fixed with @nogc available.

toUpperInPlace should be removed.

Nonsense. It still works 99% of the time (I think only a subset of 100 letters in all of Unicode are affect, and even then, another 100 of them *shrink* on toUpper). It is really useful. It avoids *needles* allocations. Removing it would be more harmful than useful.

I'm pretty confident that most of the time it is used, people don't care *that* much that *absolutely* no allocation takes place. They just don't want to be wasteful.

It cannot work reliable in place.

Rename "toUpperMaybeInPlace".

Then, for those that absolutely *can't* allocate provide a better interface. For example:
`void toUpper(S, O)(S s, ref O o);`

Burden on the caller to make it "inplace" from that (or to allocate accordingly when inplace is not possible).

Reply via email to