Proposal for fixing dchar ranges
Johannes Pfau
nospam at example.com
Mon Mar 10 11:54:22 PDT 2014
Am Mon, 10 Mar 2014 13:55:00 -0400
schrieb "Steven Schveighoffer" <schveiguy at yahoo.com>:
> On Mon, 10 Mar 2014 13:06:08 -0400, Brad Anderson <eco at gnuk.net>
> wrote:
>
> > It seems like this would be an even bigger breaking change than
> > Walter's proposal though (right or wrong, slicing strings is very
> > common).
>
> You're the second person to mention that, I was not planning on
> disabling string slicing. Just random access to individual chars, and
> probably .length.
>
> -Steve
Unfortunately slicing by code units is probably the most important
safety issue with the current implementation: As was mentioned in the
other thread:
size_t index = str.countUntil('a');
auto slice = str[0..index];
This can be a safety and security issue. (I realize that this would
break lots of code so I'm not sure if we should/can fix it. But I think
this was the most important problem mentioned in the other thread.)
More information about the Digitalmars-d
mailing list