[Issue 10867] New: Allow variadic function parameter in a @property function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Aug 21 17:32:12 PDT 2013
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: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 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: -------
More information about the Digitalmars-d-bugs
mailing list