DIP60: @nogc attribute

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Sun Apr 20 02:09:30 PDT 2014


On 2014-04-19 15:40, monarch_dodra wrote:

> 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 implicitly referring to toLowerInPlace as well.

> 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 still has a confusing name.

> Rename "toUpperMaybeInPlace".

Actually, the functionality is useful, it's just the name that is confusing.

> 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).


-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list