[Issue 664] is(func T == function) ignores variadic arguments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 20 03:54:31 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=664



--- Comment #10 from Stewart Gordon <smjg at iname.com> 2011-12-20 03:54:21 PST ---
(In reply to comment #9)
> Complete section of the spec:
> ------
> 6. is ( Type Identifier == TypeSpecialization )

You were suggesting in comment 6 that is(x == function), not is(x T ==
function), should fail if x is variadic.

> keyword     alias type for Identifier
> function     TypeTuple of the function parameter types
> ------
> This is impossible if the function has a C-style variadic parameter. Although
> solution (2) would allow it to be a Tuple, it wouldnt be a TypeTuple. So a
> change to the spec is inevitable.

I see now.  So I suppose what we need is distinct syntaxes for extracting
variadic and non-variadic parameter lists.  So maybe:

    is ( Type == function )
        passes iff Type is a function type, variadic or not
    is ( Type Identifier == function )
        passes iff Identifier is a non-variadic function type, and 
        binds Identifier to a tuple of the parameter types
    is ( Type Identifier , ... == function )
        passes iff Identifier is a variadic function type, and binds
        Identifier to a tuple of the fixed parameter types

-- 
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