[Issue 664] is(func T == function) ignores variadic arguments
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Dec 7 02:29:55 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |clugdbug at yahoo.com.au
--- Comment #4 from Don <clugdbug at yahoo.com.au> 2011-12-07 02:29:39 PST ---
There are two ways to fix this:
(1) Change the spec to define that (is == function) returns the non-variadic
parameters.
(2) Create a '...' object inside the compiler, and allow it to be a member of a
tuple. Variadics are neither types nor expressions, nor symbols. Creates lots
of special cases all through the compiler.There are tricky examples like:
template baa(T...) {
alias void function(T) a; // OK, params are (char, ...)
alias void function(T, ...) b; // illegal: (char, ..., ...)
alias void function(T, int) c; // illegal: (char, ..., int)
}
alias baa!( is ( void function(char, ...) == function)).b baz;
And if we fix those problems, maybe we should allow this syntax:
alias baa!(char, ...).a foo;
because otherwise I don't know what to print when you do:
pragma(msg, T);
but then we have to make sure we can always distinguish variadic function
parameters from template variadics.
Is this issue important enough to justify (2) ?
--
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