www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9207] New: std.array.join of immutable(string[])

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

           Summary: std.array.join of immutable(string[])
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



import std.array: join;
void main() {
    string[] names1;
    auto r1 = names1.join(); // OK
    immutable string[] names2;
    auto r2 = names2.join(); // error
}


DMD 2.061alpha gives:


test.d(6): Error: template std.array.join does not match any function template
declaration. Candidates are:
...\dmd2\src\phobos\std\array.d(1441):        std.array.join(RoR, R)(RoR ror, R
sep) if (isInputRange!(RoR) && isInputRange!(ElementType!(RoR)) &&
isForwardRange!(R) && is(Unqual!(ElementType!(ElementType!(RoR))) ==
Unqual!(ElementType!(R))))
...\dmd2\src\phobos\std\array.d(1451):        std.array.join(RoR)(RoR ror) if
(isInputRange!(RoR) && isInputRange!(ElementType!(RoR)))
...\dmd2\src\phobos\std\array.d(1441): Error: templte std.array.join cannot
deduce template function from argument types !()(immutable(char[][]))a

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


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh quickfur.ath.cx



This is because popFront() is not defined for an immutable array, so
isInputRange!(typeof(names2)) is false.

I don't know how one could get around this problem, since an immutable array
is, by definition, immutable, so popFront() cannot possibly be valid on such an
array.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 03 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9207




It doesn't work for immutable(string)[] either, because join() requires the
elements to be input ranges as well, but immutable(string) cannot have
popFront() defined since it's immutable.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 03 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9207


bearophile_hugs eml.cc changed:

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



*** This issue has been marked as a duplicate of issue 7690 ***

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