D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2124 - Using method or delegate from reduce! template.
Summary: Using method or delegate from reduce! template.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: Andrei Alexandrescu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-23 13:22 UTC by Brian Myers
Modified: 2015-06-09 01:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Brian Myers 2008-05-23 13:22:15 UTC
Here's a transcript of Dee Girl's conclusion about this issue. She seems to know what she's talking about:

This code does not work:

#!/home/yasuko/bin/rdmd -O -release
import std.algorithm;

class Sorter {}

class ExternalSorter : Sorter {
    string Merge(string f1, string f2) {
        return f1 ~ f2;
    }

    void Sort() {
        string[] chunk_list = [ "a", "b" ];
        auto mrg = &Merge;
        auto retfile = reduce!(mrg)(chunk_list[0], chunk_list[1..$]);
    }
}

void main(string[] args)
{
    auto s = new ExternalSorter;
    s.Sort;
}

But I know how to make it work because I look at the error message. You go to std.algorithm and make NxNHelper from private to public. Then inside NxNHelper also make For from private to public. Then code works.

Maybe bug report to Walter is necessary. Private should work because lookup is in correct module. It is bug in compiler not library. Can you please? Thank you, Dee Girl
Comment 1 Andrei Alexandrescu 2008-05-23 13:55:51 UTC
Many thanks to Dee Girl for finding this bug, and to Brian for relaying it. Walter is working on eliminating this and related bugs, and also on improving support for flexible alias matching in templates. We are committed on bringing a great feature to perfection.
Comment 2 Andrei Alexandrescu 2010-09-26 07:02:14 UTC
Has been fixed a few releases ago.