[Issue 6927] New: Better @property management by chained functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 9 20:24:53 PST 2011


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

           Summary: Better @property management by chained functions
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-11-09 20:24:15 PST ---
I think this code is correct:


@property int[] foo() {
    return [1, 2];
}
int[] bar(int[] a) {
    return a;
}
void main() {
    bar(foo); // OK
    foo.bar(); // line 9, Error
}



But DMD 2.057head gives:
test.d(9): Error: function expected before (), not bar(foo()) of type int[]


This makes the usage of D language less uniform, because code like this is
refused (and sometimes you can't replace an array attribute by a @property
getter because of this):

auto sortedAKeys = a.keys.sort(); // error

-- 
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