[Issue 11808] std.uni.CodepointSet('А', 'Я'+1, 'а', 'я'+1) asserts

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 24 05:40:29 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11808



--- Comment #4 from Илья Ярошенко <ilyayaroshenko at gmail.com> 2013-12-24 05:40:28 PST ---
(In reply to comment #1)
> (In reply to comment #0)
> > import std.uni;
> > 
> > auto set1 = CodepointSet('А', 'Я'+1, 'а', 'я'+1);
> 
> 
> >     {
> >         assert(intervals.length % 2 == 0, "Odd number of interval bounds [a,
> > b)!");
> >         for(uint i=1; i<intervals.length; i++)
> > 
> > 
> >             assert(intervals[i-1] < intervals[i]);
> > //_______________________________!!!
> 
> Indeed the assumption is that intervals are strictly disjoint and sorted.
> I'm not sure if it's documented exactly like that but it should be.
> 
> If it's not known in advance then creating a set per interval and using
> operator | would work. 
> I'm not sure how much to tweak this constructor, e.g. allow partially
> overlapped intervals? Allow unordered intervals?
> 
> auto set2 = CodepointSet('а', 'я'+1, 'А', 'Я'+5);


I think that we need to allow in constructor:
1. an empty range: [a..a+1)
2. two or more ranges that looks like : [a..b+1) [b+1..c) like in bug example
(this case IS NOT overlapping).
3. unordered intervals (user don't know я>Я or Я>я)

But do not allow partially overlapped intervals. 
For overlapped intervals operator "|" should be using.

PS
Excuse me for my English.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list