www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11808] New: std.uni

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11808

           Summary: std.uni
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: ilyayaroshenko gmail.com


--- Comment #0 from Илья Ярошенко <ilyayaroshenko gmail.com>
2013-12-23 12:23:32 PST ---
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
    }

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 23 2013
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11808


Dmitry Olshansky <dmitry.olsh gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh gmail.com


--- Comment #1 from Dmitry Olshansky <dmitry.olsh gmail.com> 2013-12-23
12:55:48 PST ---
(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); -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 23 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11808



--- Comment #2 from Илья Ярошенко <ilyayaroshenko gmail.com>
2013-12-24 05:21:15 PST ---
As user don

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 24 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11808



--- Comment #3 from Илья Ярошенко <ilyayaroshenko gmail.com>
2013-12-24 05:38:59 PST ---
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: -------
Dec 24 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11808



--- Comment #4 from Илья Ярошенко <ilyayaroshenko 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: -------
Dec 24 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11808


Dmitry Olshansky <dmitry.olsh gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
         AssignedTo|nobody puremagic.com        |dmitry.olsh gmail.com


--- Comment #5 from Dmitry Olshansky <dmitry.olsh gmail.com> 2014-01-06
03:12:26 PST ---
https://github.com/D-Programming-Language/phobos/pull/1837

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 06 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11808



--- Comment #6 from github-bugzilla puremagic.com 2014-01-07 11:43:40 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/4e5b777432a328160f6f2e29f26564bda52a6d13
fix issue 11808

https://github.com/D-Programming-Language/phobos/commit/b364a2f5f5065a1e843c01516068a27d5c6586b2
Merge pull request #1837 from blackwhale/issue-11808

Fix issue 11808 std.uni.CodepointSet('А', 'Я'+1, 'а', 'я'+1) asserts

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 07 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11808


Dmitry Olshansky <dmitry.olsh gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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