[Issue 6970] New: Pseudo Members
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 18 04:08:34 PST 2011
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 at puremagic.com
ReportedBy: a11160678 at nepwk.com
--- Comment #0 from Matthias Frei <a11160678 at 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: -------
More information about the Digitalmars-d-bugs
mailing list