On 05/30/2016 04:35 PM, Seb wrote:
That's a great idea - the compiler should also issue deprecation
warnings when I try to do things like:

string a  = "你好";

a[1]; // deprecation: direct access to a Unicode string is highly
error-prone. Please specify the type of access. More details (shortlink)

a[1] = "b"; // deprecation: direct index assignment to a Unicode string
is ...

a.length; // deprecation: a Unicode string has multiple definitions of
length. Please specify your iteration (...). More details (shortlink)

...

Btw should a[] be an alias for `byCodeUnit` or also trigger a warning?

All this is only sensible when we move to a dedicated string type that's not just an alias of `immutable(char)[]`.

`immutable(char)[]` explicitly is an array of code units. It would not be acceptable, in my opinion, if the normal array syntax got broken for it.

Reply via email to