VLERange: a range in between BidirectionalRange and RandomAccessRange

foobar foo at bar.com
Sun Jan 16 09:28:09 PST 2011


Michel Fortin Wrote:

> On 2011-01-16 02:11:14 -0500, foobar <foo at bar.com> said:
> 
> > I Understand your concern regarding a simpler implementation. You want 
> > to minimize the disruption caused by the proposed change.
> > 
> > I'd argue that creating a specialized string type as Steve suggests 
> > makes integration *easier*. Your suggestion requires that foreach will 
> > be changed to default to grapheme. I agree that this can be done 
> > because it will not break silently but with Steve's string type this is 
> > unnecessary since the type itself would provide a grapheme range 
> > interface and the compiler doesn't need to know about this type at all. 
> > string becomes a regular library type.
> > 
> > Of course, the type should support:
> > string foo = "bar";
> > by making an implicit conversion from current arrays (to minimize 
> > compiler changes)
> 
> It should also work for:
> 
> 	auto foo = "bar";

Right. This does require compiler changes.
 
> 
> 
> > The only disruption as far as I can tell would be using 'a' type 
> > literals instead of "a" but that will come up in compilation after 
> > string defaults to the new type.
> 
> You say "after string defaults to the new type", but I don't think this 
> change to the language will pass. It'll break TDPL for one thing, so 
> it's surely out for D2. And I somewhat doubt it's low-level enough for 
> Walter's taste.
> 

string is an alias in phobos so it's more of a stdlib change but I see your point about TDPL. I did get the feeling that Andrei is willing to make a change if it proves worthwhile by preventing writing bad code (Which we both agree this change accomplishes). 

> I don't care much if the default type is an array or not, I just want 
> the default type to work properly as a Unicode string. The very small 
> participation to this thread from the key decision makers (Andrei and 
> Walter) worries me however. I'm not even sure we'll achieve that goal.
> 
> 

Anderi did take part and even asked for links that explain the subject. Perhaps the quite is due to the mastermind doing research on the topic rather than reluctance to do any changes. :)
  
> -- 
> Michel Fortin
> michel.fortin at michelf.com
> http://michelf.com/
> 



More information about the Digitalmars-d mailing list