Jump to page: 1 2
Thread overview
[Issue 664] New: is(func T == return) ignores variadic arguments
Dec 09, 2006
d-bugmail
Dec 09, 2006
Bruno Medeiros
[Issue 664] is(func T == function) ignores variadic arguments
Dec 10, 2006
d-bugmail
Dec 10, 2006
Thomas Kuehne
Dec 07, 2011
Don
Dec 18, 2011
Stewart Gordon
Dec 19, 2011
Don
Dec 19, 2011
Stewart Gordon
Dec 20, 2011
Don
Dec 20, 2011
Don
Dec 20, 2011
Stewart Gordon
Dec 20, 2011
Don
Dec 20, 2011
Stewart Gordon
Dec 20, 2011
Don
Jan 21, 2012
Walter Bright
December 09, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=664

           Summary: is(func T == return) ignores variadic arguments
           Product: D
           Version: 0.176
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: thomas-dloop@kuehne.cn


according to is(... == return) all the functions below have the same argument
types:

void foo(int);
void foo(int ...);
void foo(int, ...);


-- 

December 09, 2006
d-bugmail@puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=664
> 
>            Summary: is(func T == return) ignores variadic arguments
>            Product: D
>            Version: 0.176
>           Platform: PC
>         OS/Version: Linux
>             Status: NEW
>           Severity: normal
>           Priority: P2
>          Component: DMD
>         AssignedTo: bugzilla@digitalmars.com
>         ReportedBy: thomas-dloop@kuehne.cn
> 
> 
> according to is(... == return) all the functions below have the same argument
> types:
> 
> void foo(int);
> void foo(int ...);
> void foo(int, ...);
> 
> 

perhaps you mean '== function' and not '== return' ?

-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
December 10, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=664


thomas-dloop@kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|is(func T == return) ignores|is(func T == function)
                   |variadic arguments          |ignores variadic arguments




------- Comment #1 from thomas-dloop@kuehne.cn  2006-12-10 07:03 -------
"is(... == function)" instead of "is(... == return)"

Thanks to Bruno Medeiros for catching this.


-- 

December 10, 2006
d-bugmail@puremagic.com schrieb am 2006-12-10:
> http://d.puremagic.com/issues/show_bug.cgi?id=664

> ------- Comment #1 from thomas-dloop@kuehne.cn  2006-12-10 07:03 -------
> "is(... == function)" instead of "is(... == return)"
>
> Thanks to Bruno Medeiros for catching this.

Added to DStress as http://dsrtess.kuehne.cn/compile/i/is_16_A.d http://dsrtess.kuehne.cn/compile/i/is_16_B.d http://dsrtess.kuehne.cn/compile/i/is_16_C.d

Thomas


November 26, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=664


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |bugzilla@digitalmars.com


--- Comment #3 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-11-26 13:22:37 PST ---
Fixed URLs:

http://dstress.kuehne.cn/compile/i/is_16_A.d http://dstress.kuehne.cn/compile/i/is_16_B.d http://dstress.kuehne.cn/compile/i/is_16_C.d

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 07, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #4 from Don <clugdbug@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: -------
December 18, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664



--- Comment #5 from Stewart Gordon <smjg@iname.com> 2011-12-17 18:27:18 PST ---
(3) Have function(char, ...) just not matching function(T) for any value of T.
... is a fundamentally different kind of thing from a type, so it doesn't seem
to make sense to allow it as an element of a type tuple.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 19, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664



--- Comment #6 from Don <clugdbug@yahoo.com.au> 2011-12-19 04:59:44 PST ---
(In reply to comment #5)
> (3) Have function(char, ...) just not matching function(T) for any value of T.
> ... is a fundamentally different kind of thing from a type, so it doesn't seem
> to make sense to allow it as an element of a type tuple.


How does that solve the problem? The root cause is that is( ==function) assumes
that all of the function parameters can be returned in a tuple, but that isn't
true for ...
Or do you mean that is( x==function) should be an error if x has a variadic
parameter?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 19, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664



--- Comment #7 from Stewart Gordon <smjg@iname.com> 2011-12-19 05:23:40 PST ---
(In reply to comment #6)
> How does that solve the problem? The root cause is that is( ==function) assumes that all of the function parameters can be returned in a tuple, but that isn't true for ...

In what way does it make that assumption?

> Or do you mean that is( x==function) should be an error if x has a variadic
> parameter?

Of course not.  What would be the point of that?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 20, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664



--- Comment #8 from Don <clugdbug@yahoo.com.au> 2011-12-19 22:34:00 PST ---
(In reply to comment #7)
> (In reply to comment #6)
> > How does that solve the problem? The root cause is that is( ==function) assumes that all of the function parameters can be returned in a tuple, but that isn't true for ...
> 
> In what way does it make that assumption?

It declares T as a tuple containing all of the function arguments.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
« First   ‹ Prev
1 2