www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3639] New: std.conv.to!string(anytype[numeric]) items order seems inconsistent

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

           Summary: std.conv.to!string(anytype[numeric]) items order seems
                    inconsistent
           Product: D
           Version: 2.036
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: julien onandon.be


--- Comment #0 from Julien Leclercq <julien onandon.be> 2009-12-22 06:03:27 PST
---
Created an attachment (id=530)
Test case

Hello,

    the order of the items seems inconsistent depending on key type.

    Please see the attachment.

Thank you,
Julian.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 22 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3639


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei metalanguage.com


--- Comment #1 from Andrei Alexandrescu <andrei metalanguage.com> 2009-12-22
06:56:19 PST ---
This is by design - associative arrays don't come out in key sorted order. We
could change that behavior but that would make the function slower.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 22 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3639



--- Comment #2 from Julien Leclercq <julien onandon.be> 2009-12-22 07:29:04 PST
---
Created an attachment (id=531)
Quick hack

Would this quick hack make the function slower too ? Tested with a few
unittests. It removes the segfaults from anytype[ushort] too.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 22 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3639



--- Comment #3 from Julien Leclercq <julien onandon.be> 2009-12-22 07:30:52 PST
---
Created an attachment (id=532)
Quick hack (const s.length)

Small correction.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 22 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3639



--- Comment #4 from Julien Leclercq <julien onandon.be> 2009-12-22 07:32:53 PST
---
Created an attachment (id=533)
if (i > 0) result.put(separator);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 22 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3639



--- Comment #5 from Andrei Alexandrescu <andrei metalanguage.com> 2009-12-22
08:02:56 PST ---
(In reply to comment #4)
 Created an attachment (id=533) [details]
 if (i > 0) result.put(separator);

The code assumes the set of numeric keys is contiguous, which is untrue for most associative arrays. For example, trying the code with [5:"a", 100:"b"] will fail. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 22 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3639



--- Comment #6 from Julien Leclercq <julien onandon.be> 2009-12-22 08:16:07 PST
---
Right. Back to slow indexes sorting.

Thank you,
Julian.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 22 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3639


Andrei Alexandrescu <andrei metalanguage.com> changed:

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


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