[Issue 2194] New: Variadic parameters of non-array types
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jul 5 05:20:01 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2194
Summary: Variadic parameters of non-array types
Product: D
Version: 2.013
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: brunodomedeiros+bugz at gmail.com
D accepts variadic parameters that are not array types, such as this:
void foo(int bar ...)
However this does not make much sense, since the bar parameter is not variadic,
the function can only be called with one argument.
To avoid confusion, it would be an improvement to disallow non-array parameter
types as variadic parameters.
An alternatice sugestion, would be for any variadic parameter to automatically
become of the array type of the type declared in the signature. Such that in:
void foo(int bar ...)
then typeof(bar) becomes int[]. This behavior would be identical to Java. Also
it would allow a further improvement, a more consistent syntax for lazy
variadic templates, like this:
void foo(lazy int bar ...)
where typeof(bar) would be int delegate()[]
And we would no longer need the awkward special case where variadic arguments
can be converted to delegates, such as with this:
void cond(bool delegate()[] cases ...)
--
More information about the Digitalmars-d-bugs
mailing list