Range of chars (narrow string ranges)
H. S. Teoh via Digitalmars-d
digitalmars-d at puremagic.com
Mon Apr 27 09:58:14 PDT 2015
On Sat, Apr 25, 2015 at 02:27:45AM +0000, Jonathan M Davis via Digitalmars-d wrote:
[...]
> I suppose that a related alternative would be to change it so that
> strings aren't considered ranges anymore (at least temporarily), and
> force folks to use stuff like byChar or byDChar (or whatever those
> functions are) whenever they use strings as ranges. And actually, that
> _would_ allow us to get rid of the autodecoding without rearranging
> modules. Later, we could change them to being ranges of their actual
> element types, or we could just force folks to be explicit forever in
> an effort to make the Unicode issues clear, if we thought that that
> were better (though it would probably better to just change front and
> friends later to work with strings again but not autodecode). And if
> an algorithm would work with either autodecoding or without it, then
> maybe it could be special cased to accept strings as ranges, only
> forcing it in the cases where it the behavior of the algorithm would
> change based on whether autodecoding were used or not.
>
> Hmmm. I'm not sure what all of the repercussions of such an approach
> would be, but the more I think about it, the more tempting it seems to
> me.
[...]
I would vote for this approach, if we ever decide to get rid of
autodecoding. I'm OK with either option -- get rid of autodecoding, or
keep it and use it consistently. What I am *not* OK with is the present,
and growing, schizophrenic mixture of autodecoding and non-autodecoding
string functions in Phobos. This inconsistency is going to come back to
bite us later.
T
--
One reason that few people are aware there are programs running the internet is that they never crash in any significant way: the free software underlying the internet is reliable to the point of invisibility. -- Glyn Moody, from the article "Giving it all away"
More information about the Digitalmars-d
mailing list