Request for "indexOf" undeprecation.

monarch_dodra monarchdodra at gmail.com
Fri Nov 16 05:18:02 PST 2012


I'd like to get a green light to undeprecate "indexOf".

The rationale for the original deprecation is that it was 
superseded by "countUntil", which also works on forward ranges 
(indexOf implies, by name, that it only operates on RA).

There is just one problem:
"日本語".indexOf(本) => 3
"日本語".countUntil(本) => 1

As you can see, when operating on UTF strings, the (expected) 
result of countUntil is not the same as that of indexOf.

countUntil is currently bugged, in the sense that it will return 
the index in the string (as opposed to the count of popFront's). 
However, this needs fixing. If users migrate countUntil to 
indexOf without thinking, it could lead to some terrible, 
terrible bugs.

Phobos was migrated. I found the issue in datetime (which is 
"OK", since date is ASCII), but also in std.path, which is NOT 
OK. At all. Who knows what's out there in the nature?

-------
So yeah, I want to un-deprecate indexOf, and re-document it as 
working only on RA.

Can I get some Yays or Nays?


More information about the Digitalmars-d mailing list