November 18, 2011 [Issue 6970] New: Pseudo Members | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from Matthias Frei <a11160678@nepwk.com> 2011-11-18 04:07:45 PST --- 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: ------- |
November 18, 2011 [Issue 6970] Pseudo Members | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthias Frei | 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 --- Comment #1 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2011-11-18 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: ------- |
Copyright © 1999-2021 by the D Language Foundation