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

           Summary: Allow variadic function parameter in a @property
                    function
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Andrej Mitrovic <[email protected]> 2013-08-21 
17:32:11 PDT ---
Currently if you want to allow a @property function to be called with both a
single element type or an array of such elements types, you need to provide two
property functions, for example:

-----
struct S
{
    @property void selection(int[] arr) { }
    @property void selection(int arr) { }
}

void main()
{
    S s;
    s.selection = 1;  // select one item
    s.selection = [1, 3];  // select multiple items
}
-----

But it would be simpler if we allowed a variadic parameter in a property
function:

-----
struct S
{
    // one property
    @property void selection(int[] arr...) { }
}

void main()
{
    S s;
    s.selection = 1;  // select one item
    s.selection = [1, 3];  // select multiple items
}
-----

I've found this feature to be useful in GUI-related code.

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

Reply via email to