On Thursday, September 22, 2016 08:51:59 Andrei Alexandrescu via Digitalmars-d wrote: > On 9/22/16 6:38 AM, pineapple wrote: > > The greatest offender I've found is how in phobos, arrays do not behave > > as ranges without importing the module defining their range operations. > > Would make sense to move those few primitives to object.d. I've been > thinking of that a long time ago but back then there was a vague stance > that object.d shouldn't contain templates. Since then that has changed. > -- Andrei
The main problem with moving them there is auto-decoding. front and popFront for strings require std.utf in order to do their thing. So, if we move them to druntime, then that code would need to be duplicated (though similar code already has to exist in druntime for foreach loops), and we'd have a problem with invalid unicode in that it couldn't through std.utf.UTFException like it would now (though ideally, we'd stop throwing on invalid unicode and use the replacement character). That being said, I agree that the range functions for arrays should go in object.d. It's just that the way we handle narrow strings as ranges makes it problematic. - Jonathan M Davis