www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11914] New: Missed tuple unpacking in foreach for cartesianProduct

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

           Summary: Missed tuple unpacking in foreach for cartesianProduct
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2014-01-13 04:55:25 PST ---
This program compiles:


void main() {
    import std.algorithm: cartesianProduct;
    foreach (ijk; cartesianProduct([1], [1], [1])) {}
}


This doesn't compile, but it used to compile:

void main() {
    import std.algorithm: cartesianProduct;
    foreach (i, j, k; cartesianProduct([1], [1], [1])) {}
}


dmd 2.065alpha gives:

test.d(3): Error: cannot infer argument types



If I add both it compiles again:

void main() {
    import std.algorithm: cartesianProduct;
    foreach (ijk; cartesianProduct([1], [1], [1])) {}
    foreach (i, j, k; cartesianProduct([1], [1], [1])) {}
}



(Generally I think this tuple unpacking is a misfeature of D and should be
removed, and replaced by a better and more general solution. But if we want to
remove this feature, it should go through a deprecation path, and not break
randomly as here. So I have marked this as regression).

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 13 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11914


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid
           Platform|x86                         |All
         OS/Version|Windows                     |All


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2014-01-13 22:33:18 PST ---
https://github.com/D-Programming-Language/dmd/pull/3091

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 13 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11914



--- Comment #2 from github-bugzilla puremagic.com 2014-01-14 13:19:44 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/7bbbed54d8fc32c1c538b5cd44a7ac5e45ea610b
fix Issue 11914 - Missed tuple unpacking in foreach for cartesianProduct

https://github.com/D-Programming-Language/dmd/commit/dce6d8cdbb972e2704ca54d4db15502dd60ea8b8
Merge pull request #3091 from 9rnsr/fix11914

[REG2.065a] Issue 11914 - Missed tuple unpacking in foreach for
cartesianProduct

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 14 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11914


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


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