On Saturday, July 28, 2012 23:23:30 Era Scarecrow wrote: > On Saturday, 28 July 2012 at 21:07:31 UTC, Jonathan M Davis wrote: > > I would point out that while hasSlicing doesn't currently check > > for it, if opSlice doesn't return a type which is assignable to > > the original range, it won't work in a lot of Phobos functions. > > I keep meaning to bring that up for discussion in the main > > newsgroup. I'd argue that hasSlicing really be changed > > Which is one of the main reasons I am hesitant to have a > separate range struct (of BitSlice)... Hmmm maybe we should keep > it here for a little while, and talk it over a bit more.
Well, it seems that my comment was somewhat misplaced in that BitArray isn't a range but a container. My comment was directed at opSlice on ranges. Container types should return whatever range type is appropriate. That will usually be a struct of some variety. I'd have to study BitArray and your changes to determine what the appropriate type was here, but it sounds like you were talking about duping the contents with opSlice, which would be highly irregular. Normally, ranges over containers are light wrappers which can iterate through and potentially alter the elements in the container, and duping up an array as the range type doesn't work like that. But depending on what BitArray is doing exactly, it might be appropriate. I don't know. - Jonathan M Davis