[Issue 9630] DMD git: can't access array field properties from static method

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 1 22:03:54 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9630



--- Comment #8 from Kenji Hara <k.hara.pg at gmail.com> 2013-03-01 22:03:52 PST ---
If `i[0].max` should be accepted, how about this?

struct S
{
    int[] arr;

    static void foo()
    {
        auto x = arr.map!(x => x*2).filter!(x > 4).array[0].max;
    }
}

The part expression `arr.map!(x => x*2).filter!(x > 4).array[0]` is never
evaluated, because it is just used for calculate its type. It looks much weird
to me. I think such *implicit typeof* feature is not good. Instead:

        auto x = typeof(arr.map!(x => x*2).filter!(x > 4).array[0]).max;

is much better. I think language should enforce the latter.

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


More information about the Digitalmars-d-bugs mailing list