"headconst" dynamic arrays?

bearophile bearophileHUGS at lycos.com
Wed Aug 31 12:44:02 PDT 2011


Marco Leise:

> Likewise people sometimes modify the input until they've got what  
> they want. Clamping numbers, prefixing strings or replacing default/null  
> values are use cases.

Think about an in-place sort routine. I give an array to it, and its items get shuffled, but nowhere inside the sort routine I want the array length to change. I'd like the array length to be const, but the array items to be mutable. In Phobos there are other examples of in-pace array functions. A system language offers such freedom too.

Bye,
bearophile


More information about the Digitalmars-d mailing list