Proposal for fixing dchar ranges

Steven Schveighoffer schveiguy at yahoo.com
Mon Mar 10 14:19:15 PDT 2014


On Mon, 10 Mar 2014 16:54:34 -0400, John Colvin   
<john.loughran.colvin at gmail.com> wrote:
> Of course that i has to be at the beginning of a code-point. Doesn't  
> seem like that useful a feature and potentially very confusing for  
> people who naively expect normal indexing.

What it would do is remove the confusion of is(typeof(r.front) !=   
typeof(r[0]))

Naivety is to be expected when you have made your C-derived language's  
default string type an encoded UTF8 array called char[]. It doesn't  
magically make D programs UTF aware.

I would suggest that a lofty goal is for the string type to be completely  
safe, and efficient, and only allow raw access via the .representation  
member. But I don't think, given the current code base,
that we can achieve that in one proposal. It has to be gradual. This is a  
first step.

-Steve


More information about the Digitalmars-d mailing list