Comment #0 by andrej.mitrovich — 2013-08-21T17:32:11Z
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.
Comment #1 by robert.schadek — 2024-12-13T18:10:47Z