Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
October 20, 2007 [Issue 1600] New: Functions taking only one array cannot be called with property syntax | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=1600 Summary: Functions taking only one array cannot be called with property syntax Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: andrei@metalanguage.com Consider: void test(int[]) {} void main() { int[] a; test(a); // fine a.test(); // fine a.test; // error! } This irregularity should be fixed. One important reason for using the property syntax is terseness. -- |
October 31, 2007 [Issue 1600] Functions taking only one array cannot be called with property syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1600 wbaxter@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wbaxter@gmail.com ------- Comment #1 from wbaxter@gmail.com 2007-10-31 03:27 ------- It's especially bad since built-in properties have the opposite restriction. { int[] a; a.sort(); // error! a.sort; // fine } Personally I think the () variety should be allowed for the built-in properties also. -- |
November 08, 2007 [Issue 1600] Functions taking only one array cannot be called with property syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1600 smjg@iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg@iname.com Keywords| |spec ------- Comment #2 from smjg@iname.com 2007-11-08 08:45 ------- I personally think the () should be required in both cases. AISI a property can be used in four ways: - as an lvalue - as an rvalue - explicitly calling it with ( ) - taking the address of the getter/setter function Using it by itself as an ExpressionStatement is none of these. But it certainly seems wrong that an array property can't even be used as an rvalue: ---------- int test(int[]) { return 0; } void main() { int[] a; int b; b = test(a); // fine b = a.test(); // fine b = a.test; // error! } ---------- bz1600a.d(9): Error: no property 'test' for type 'int[]' ---------- (DMD 1.023, Windows) -- |
August 04, 2009 [Issue 1600] Functions taking only one array cannot be called with property syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1600 Rob Jacques <sandford@jhu.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sandford@jhu.edu --- Comment #3 from Rob Jacques <sandford@jhu.edu> 2009-08-03 19:17:01 PDT --- This works in D2.031: void foo(int[] x) {} int main(char[][] args) { auto x = new int[5]; x.foo; return 0; } So maybe this should be closed? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 25, 2009 [Issue 1600] Functions taking only one array cannot be called with property syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1600 Andrei Alexandrescu <andrei@metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #4 from Andrei Alexandrescu <andrei@metalanguage.com> 2009-08-24 22:20:03 PDT --- Seems to be fixed as of 2.031. -- 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