std.algorithm.remove and principle of least astonishment

so so at so.do
Mon Nov 22 08:00:14 PST 2010


> Easy:
>   - string_t becomes a keyword.
>   - Syntactically speaking, string_t!T is the name of a type when T is a
> type.
>   - For every built-in character type T (including const and immutable
> versions), the type currently called T[] is now called string_t!T, but
> otherwise maintains all of its current behavior.
>   - For every other type T, string_t!T is an error.
>   - char[] and wchar[] (including const and immutable versions) are
> plain arrays of code units, even when viewed as a range.
>
> It's not my preferred solution, but it's easy to explain, it fixes the
> main problem with the current system, and it only costs one keyword.
>
> (I'd rather treat string_t as a library template with compiler support
> like and rename it to String, but then it wouldn't be a built-in string.)

Or better, if you want both ranges and random access do same thing,  
convert it to byte[] short[] and int[].

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list