Thread overview
[Issue 3857] New: Write property for arrays does not work properly
Oct 22, 2012
Andrej Mitrovic
February 26, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3857

           Summary: Write property for arrays does not work properly
           Product: D
           Version: 2.040
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: schveiguy@yahoo.com


--- Comment #0 from Steven Schveighoffer <schveiguy@yahoo.com> 2010-02-26 14:08:01 PST ---
If I were to define a write property for arrays foo that takes an int arg, none of the following prototypes work:

main code:
int[] x;
x.foo = 1;

test cases:
@property void foo(T)(T[] arr, int x) {}
or
void foo(T)(T[] arr, int x) {}

outputs:
testbug.d(10): Error: template testbug.foo(T) does not match any function
template declaration
testbug.d(10): Error: template testbug.foo(T) cannot deduce template function
from argument types !()(int[])
testbug.d(10): Error: x.foo is not an lvalue

test case:
@property void foo(int[] arr, int x) {}

outputs:
testbug.d(4): Error: properties can only have zero or one parameter

test case:
void foo(int[] arr, int x) {}

outputs:
testbug.d(10): Error: function testbug.foo (int[] arr, int x) is not callable
using argument types (int[])
testbug.d(10): Error: expected 2 function arguments, not 1
testbug.d(10): Error: x.foo is not an lvalue
testbug.d(10): Error: cannot implicitly convert expression (1) of type int to
void

I think at least the two variations that use @property should work.  They are pretty unambiguous.

This is blocking my work on the array pre-allocate patch.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 15, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3857


Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3
           Severity|critical                    |normal


--- Comment #1 from Steven Schveighoffer <schveiguy@yahoo.com> 2010-03-15 13:07:27 PDT ---
Downgrading severity.  This is no longer blocking the array append work, since it was determined that a property was not the best syntax.

I still think this should work.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 09, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3857


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3857


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |andrej.mitrovich@gmail.com
         Resolution|                            |FIXED


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-21 20:14:21 PDT ---
Seems to be fixed.

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