Jump to page: 1 2
Thread overview
[Issue 8851] std.string.join should allow 'char' as joiner
Sep 11, 2014
Robert Schadek
Sep 12, 2014
Andrej Mitrovic
Sep 12, 2014
Robert Schadek
Sep 12, 2014
Andrej Mitrovic
Sep 12, 2014
Andrej Mitrovic
Sep 12, 2014
Robert Schadek
Sep 16, 2014
Robert Schadek
Sep 16, 2014
Robert Schadek
Sep 18, 2014
Robert Schadek
Jan 03, 2015
Robert Schadek
September 11, 2014
https://issues.dlang.org/show_bug.cgi?id=8851

Robert Schadek <rburners@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rburners@gmail.com

--- Comment #10 from Robert Schadek <rburners@gmail.com> ---
anyone working on this currently?

--
September 11, 2014
https://issues.dlang.org/show_bug.cgi?id=8851

--- Comment #11 from monarchdodra@gmail.com ---
(In reply to Robert Schadek from comment #10)
> anyone working on this currently?

No one that I know of. Although 'only' was recently introduced that helped work around the issue, it is still in need of fixing.

--
September 12, 2014
https://issues.dlang.org/show_bug.cgi?id=8851

--- Comment #12 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
I've tried using only but it didn't really work.

--
September 12, 2014
https://issues.dlang.org/show_bug.cgi?id=8851

--- Comment #13 from Robert Schadek <rburners@gmail.com> ---
(In reply to Andrej Mitrovic from comment #12)
> I've tried using only but it didn't really work.

example?

--
September 12, 2014
https://issues.dlang.org/show_bug.cgi?id=8851

--- Comment #14 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
import std.string;

void main()
{
    char sep = '|';
    string z = ["foo", "bar"].join(sep.only);
}

--
September 12, 2014
https://issues.dlang.org/show_bug.cgi?id=8851

--- Comment #15 from monarchdodra@gmail.com ---
(In reply to Andrej Mitrovic from comment #14)
> import std.string;
> 
> void main()
> {
>     char sep = '|';
>     string z = ["foo", "bar"].join(sep.only);
> }

I'll assume you also imported std.range, and got this error?
Error: template std.array.join cannot deduce function from argument types ...

It seems the issue here is that the template restrictions are overzealous in that it checks for exact element type matching, rather than checking if they have a common type (Or at the very least, if ElementType!Sep is implicitly convertible to ElementType!(ElementType!RoR)).

As a workaround, using an (explicit) dchar only works.

//----
import std.range;
import std.stdio;

void main()
{
    ["foo", "bar"].join(dchar('|').only).writeln();
}
//----

So Jonathan's original
assesment(https://issues.dlang.org/show_bug.cgi?id=8851#c1) was also correct
(it's a dual issue I guess)

--
September 12, 2014
https://issues.dlang.org/show_bug.cgi?id=8851

--- Comment #16 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
Yeah, looks like we may have to make multiple fixes here? Anyway, it would be nice to get this taken care of. :)

--
September 12, 2014
https://issues.dlang.org/show_bug.cgi?id=8851

--- Comment #17 from Robert Schadek <rburners@gmail.com> ---
I'm on it

--
September 12, 2014
https://issues.dlang.org/show_bug.cgi?id=8851

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|nobody@puremagic.com        |rburners@gmail.com

--
September 16, 2014
https://issues.dlang.org/show_bug.cgi?id=8851

--- Comment #18 from Robert Schadek <rburners@gmail.com> ---
issue 5542 refers to the same bug

--
« First   ‹ Prev
1 2