Thread overview
[Issue 3132] New: std.string.split should be templated on mutable/const/immutable
Jul 03, 2009
dsimcha@yahoo.com
Jul 07, 2009
Sobirari Muhomori
Jul 07, 2009
Sobirari Muhomori
Sep 03, 2009
David Simcha
Oct 06, 2009
Walter Bright
July 03, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3132

           Summary: std.string.split should be templated on
                    mutable/const/immutable
           Product: D
           Version: 2.030
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: dsimcha@yahoo.com


Kind of like what was done with strip(), et al.  A good signature would be
something like:

String[] split(String)(String s);
String[] splitlines(String)(String s);
String[] split(String, D)(String s, D delim);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3132





--- Comment #1 from Sobirari Muhomori <maxmo@pochta.ru>  2009-07-07 01:45:40 PDT ---
A better reason is templating over wstring and dstring.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3132





--- Comment #2 from Sobirari Muhomori <maxmo@pochta.ru>  2009-07-07 01:52:20 PDT ---
templating over constness is a partial solution for bug 1961

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3132


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com




-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 08, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3132





--- Comment #3 from Steven Schveighoffer <schveiguy@yahoo.com>  2009-07-08 10:59:28 PDT ---
(In reply to comment #2)
> templating over constness is a partial solution for bug 1961

No.  I specifically say that the template solution does not achieve what 1961 is striving for -- single implementation and guaranteed const handling of parameters.  See comment #15.

Conversely, 1961 would solve this bug pretty easily :P

inout(T)[] split(T)(inout(T) s);

(replace inout with keyword of choice used to implement 1961).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 28, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3132


Andrei Alexandrescu <andrei@metalanguage.com> changed:

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




-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 03, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3132


David Simcha <dsimcha@yahoo.com> changed:

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




--- Comment #4 from David Simcha <dsimcha@yahoo.com>  2009-09-03 07:56:25 PDT ---
1.  You missed splitlines.

2.  string[] words should be S[] words or S1[] words in split().

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 03, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3132


Andrei Alexandrescu <andrei@metalanguage.com> changed:

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




--- Comment #5 from Andrei Alexandrescu <andrei@metalanguage.com>  2009-09-03 09:14:16 PDT ---
(In reply to comment #4)
> 1.  You missed splitlines.
> 
> 2.  string[] words should be S[] words or S1[] words in split().

3. I'm a chowderhead.

I fixed the above and added unittests for all string widths. If there are other functions in std.string to be modified, please open a new bugzilla entry.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 06, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3132


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com


--- Comment #6 from Walter Bright <bugzilla@digitalmars.com> 2009-10-06 02:21:16 PDT ---
Fixed dmd 2.033

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