On Tuesday, October 22, 2019 4:27:59 PM MDT Per Nordlöw via Digitalmars-d- learn wrote: > On Tuesday, 22 October 2019 at 15:39:17 UTC, Adam D. Ruppe wrote: > > On Tuesday, 22 October 2019 at 15:33:05 UTC, Per Nordlöw wrote: > >> Why isn't a call to > >> > >> skipOver(string, string) > >> > >> nothrow? > > > > without really looking, probably because of invalid utf > > sequences potentially throwing. Using the .representation > > thingy might help if im right about this. > > > > A good way to try this is to edit your copy of the Phobos file > > and add nothrow to it. That should give an error inside that is > > more descriptive. (I would love if the compiler would do this > > automatically, we were talking about maybe making that mod on > > irc yesterday). > > But startsWith(string, string) is nothrow so skipOver should be > that too.
That's only true with startsWith, because it avoids decoding in the case where the two strings have the same encoding (e.g. it's not nothrow if you compare a dstring and a string). Presumably, skipOver could be made to do the same, but no one has done so. - Jonathan M Davis