www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6970] New: Pseudo Members

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6970

           Summary: Pseudo Members
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: a11160678 nepwk.com



---
According to TDPL, 5.9.1 "Pseudo Members and the  property Attribute", D allows
pseudo-member notation:
"if a.fun(b,c,d) is seen but fun is not a member of a's type, D rewrites that
as fun(a,b,c,d) and tries that as well."

Apparantly this is only true for arrays, and even for arrays it does not work
in some cases:

void gun(ref int[]) { }
void sun(ref int[], int v) { }

int[] global;
ref int[] fun() { return global; }
 property ref int[] funProp() { return global; }

void main() {
    gun(global);       // works
    sun(global, 0);    // works
    global.gun;        // works (but shouldn't ?)
    global.gun();      // works
    global.sun(0);     // works
    fun().gun;          // works (but shouldn't ?)
    fun().gun();        // works
    fun().sun(0);       // works
    funProp.gun;        // works (but shouldn't ?)
    funProp.gun();      // does not work but should
    funProp.sun(0);     // does not work but should
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 18 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6970


Nick Sabalausky <cbkbbejeap mailinator.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |cbkbbejeap mailinator.com
         Resolution|                            |DUPLICATE



07:33:09 PST ---
Duplicate of issue 3382, issue 2883, and issue 662

*** This issue has been marked as a duplicate of issue 3382 ***

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