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 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 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.comI 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=8851I 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.comThat 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 15:26:11 PDT ---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.comTurns 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 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=8851better 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 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