Comment #0 by ilyayaroshenko — 2013-12-23T12:23:32Z
import std.uni;
auto set1 = CodepointSet('А', 'Я'+1, 'а', 'я'+1);
_________________________
This code asserts because ('Я'+1 == 'а') :
this()(uint[] intervals...)
in
{
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]);
//_______________________________!!!
}
body
{
data = Uint24Array!(SP)(intervals);
//_____________!!!!!!!!!!! I don`t know how manage Uint24Array
}
Comment #1 by dmitry.olsh — 2013-12-23T12:55:48Z
(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);
Comment #2 by ilyayaroshenko — 2013-12-24T05:21:15Z
As user don
Comment #3 by ilyayaroshenko — 2013-12-24T05:38:59Z
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.
Comment #4 by ilyayaroshenko — 2013-12-24T05:40:28Z
(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.