Bug 10867 – Allow variadic function parameter in a @property function

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-21T17:32:11Z
Last change time
2024-12-13T18:10:47Z
Assigned to
No Owner
Creator
Andrej Mitrovic
Moved to GitHub: dmd#18656 →

Comments

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
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18656 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB