[Issue 1600] Functions taking only one array cannot be called with property syntax

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 8 06:45:24 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1600


smjg at iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg at iname.com
           Keywords|                            |spec




------- Comment #2 from smjg at 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)


-- 



More information about the Digitalmars-d-bugs mailing list