digitalmars.D.bugs - [Issue 8851] New: std.string.join should allow 'char' as joiner
- d-bugmail puremagic.com (28/28) Oct 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8851
- d-bugmail puremagic.com (14/14) Oct 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8851
- d-bugmail puremagic.com (23/28) Oct 19 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8851
- d-bugmail puremagic.com (21/26) Oct 19 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8851
- d-bugmail puremagic.com (13/42) Oct 19 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8851
- d-bugmail puremagic.com (7/8) Sep 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8851
- d-bugmail puremagic.com (14/18) Sep 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8851
- d-bugmail puremagic.com (10/10) Sep 18 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8851
- d-bugmail puremagic.com (8/9) Sep 18 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8851
- d-bugmail puremagic.com (10/10) Sep 21 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8851
http://d.puremagic.com/issues/show_bug.cgi?id=8851 Summary: std.string.join should allow 'char' as joiner Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2012-10-18 15:26:25 PDT --- import std.string; void main() { char sep = '|'; string z = ["foo", "bar"].join(sep); } test.d(7): Error: template std.array.join does not match any function template declaration D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\array.d(1273): Error: template std.array.join cannot deduce template function from argument types !()(string[],char) Well apparently it's std.array.join, but nevertheless it should work. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 18 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8851 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg gmx.com --- Comment #1 from Jonathan M Davis <jmdavisProg gmx.com> 2012-10-18 16:17:08 PDT --- I expect that this stems from the stupidity of character literals defaulting to char rather than dchar, and when you couple that with the fact that templates always use the _exact_ type of what you give them, it's going to try and instantiate join with a separator of char, which doesn't work with ranges of dchar. I'm not sure how you'd go about fixing that. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 18 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8851 monarchdodra gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |monarchdodra gmail.com --- Comment #2 from monarchdodra gmail.com 2012-10-19 02:36:28 PDT --- (In reply to comment #1)I expect that this stems from the stupidity of character literals defaulting to char rather than dchar, and when you couple that with the fact that templates always use the _exact_ type of what you give them, it's going to try and instantiate join with a separator of char, which doesn't work with ranges of dchar. I'm not sure how you'd go about fixing that.I investigated, and that's not it. It's *just* that std.array.join, like std.algorithm.joiner, expects the separator to be a range. The enhancement request here would be for both "std.array.join" std.algorithm.joiner" to accept a single element as a separator. In the meantime, of course, a simple workaround is to just "join([sep])". I think this needlessly allocates a 1 element array though, no? -------- On a side note, the current restrictions in join are overly restrictive, requiring an exact match, making this illegal: int[] sep = [1]; double[] z = [[0.1], [0.2]].join(sep); When it is perfectly supported: joiner supports it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 19 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8851 --- Comment #3 from monarchdodra gmail.com 2012-10-19 02:39:28 PDT --- (In reply to comment #1)I expect that this stems from the stupidity of character literals defaulting to char rather than dchar, and when you couple that with the fact that templates always use the _exact_ type of what you give them, it's going to try and instantiate join with a separator of char, which doesn't work with ranges of dchar. I'm not sure how you'd go about fixing that.I investigated, and that's not it. It's *just* that std.array.join, like std.algorithm.joiner, expects the separator to be a range. The enhancement request here would be for both "std.array.join" std.algorithm.joiner" to accept a single element as a separator. In the meantime, of course, a simple workaround is to just "join([sep])". I think this needlessly allocates a 1 element array though, no? -------- On a side note, the current restrictions in join are overly restrictive, requiring an *exact* ElementType match, making this illegal: int[] sep = [1]; double[] z = [[0.1], [0.2]].join(sep); The implementation actually perfectly supports it. As a matter of fact, joiner supports it. I'll see into relaxing the restraints for now, and taking the opportunity to investigate using an element as a separator. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 19 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8851 monarchdodra gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|nobody puremagic.com |monarchdodra gmail.com --- Comment #4 from monarchdodra gmail.com 2012-10-19 02:45:07 PDT --- (In reply to comment #3)(In reply to comment #1)That was fast actually. Both the fix and the enhancement are trivially trivial. I believe in the change, so I'm assigning to self. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------I expect that this stems from the stupidity of character literals defaulting to char rather than dchar, and when you couple that with the fact that templates always use the _exact_ type of what you give them, it's going to try and instantiate join with a separator of char, which doesn't work with ranges of dchar. I'm not sure how you'd go about fixing that.I investigated, and that's not it. It's *just* that std.array.join, like std.algorithm.joiner, expects the separator to be a range. The enhancement request here would be for both "std.array.join" std.algorithm.joiner" to accept a single element as a separator. In the meantime, of course, a simple workaround is to just "join([sep])". I think this needlessly allocates a 1 element array though, no? -------- On a side note, the current restrictions in join are overly restrictive, requiring an *exact* ElementType match, making this illegal: int[] sep = [1]; double[] z = [[0.1], [0.2]].join(sep); The implementation actually perfectly supports it. As a matter of fact, joiner supports it. I'll see into relaxing the restraints for now, and taking the opportunity to investigate using an element as a separator.
Oct 19 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8851 --- Comment #5 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-17 15:26:11 PDT --- (In reply to comment #4)I believe in the change, so I'm assigning to self.Is this part of any open pulls you've made? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8851 monarchdodra gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEW AssignedTo|monarchdodra gmail.com |nobody puremagic.com --- Comment #6 from monarchdodra gmail.com 2013-09-17 23:34:29 PDT --- (In reply to comment #5)(In reply to comment #4)Turns out I *completely* forgot about this. If you want to do anything regarding this pull, please go right on ahead. Seems code gets into Phobos faster when I review rather than write ^^ -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------I believe in the change, so I'm assigning to self.Is this part of any open pulls you've made?
Sep 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8851 Andrei Alexandrescu <andrei erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrei erdani.com --- Comment #7 from Andrei Alexandrescu <andrei erdani.com> 2013-09-18 01:15:22 PDT --- better yet, accept dchar -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 18 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8851 --- Comment #8 from monarchdodra gmail.com 2013-09-18 03:00:56 PDT --- (In reply to comment #7)better yet, accept dcharWell, it's just a public import of std.array.join, so it should really just accept "(R, E)" and "(R, R)". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 18 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8851 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc --- Comment #9 from bearophile_hugs eml.cc 2013-09-21 05:27:57 PDT --- See also Issue 5542 that is different but related. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 21 2013