www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6927] New: Better property management by chained functions

reply d-bugmail puremagic.com writes:
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



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: -------
Nov 09 2011
next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Nov 09 2011
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Nov 16 2011