Thread overview
[Issue 6927] New: Better @property management by chained functions
Nov 10, 2011
Kenji Hara
Nov 16, 2011
Walter Bright
November 10, 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@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@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: -------
November 10, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6927


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
           Platform|x86                         |All
         OS/Version|Windows                     |All


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-11-09 23:46:29 PST ---
https://github.com/D-Programming-Language/dmd/pull/468

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 16, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6927


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2011-11-16 09:36:00 PST ---
https://github.com/D-Programming-Language/dmd/commit/7c193950c9d7fa8798b93961fd00e215998149bc

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