digitalmars.D.bugs - [Issue 664] New: is(func T == return) ignores variadic arguments
- d-bugmail puremagic.com (18/18) Dec 09 2006 http://d.puremagic.com/issues/show_bug.cgi?id=664
- Bruno Medeiros (5/28) Dec 09 2006 perhaps you mean '== function' and not '== return' ?
- d-bugmail puremagic.com (10/10) Dec 10 2006 http://d.puremagic.com/issues/show_bug.cgi?id=664
- Thomas Kuehne (13/17) Dec 10 2006 -----BEGIN PGP SIGNED MESSAGE-----
- d-bugmail puremagic.com (15/15) Nov 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=664
- d-bugmail puremagic.com (28/28) Dec 07 2011 http://d.puremagic.com/issues/show_bug.cgi?id=664
- d-bugmail puremagic.com (8/8) Dec 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=664
- d-bugmail puremagic.com (11/14) Dec 19 2011 http://d.puremagic.com/issues/show_bug.cgi?id=664
- d-bugmail puremagic.com (8/13) Dec 19 2011 http://d.puremagic.com/issues/show_bug.cgi?id=664
- d-bugmail puremagic.com (7/13) Dec 19 2011 http://d.puremagic.com/issues/show_bug.cgi?id=664
- d-bugmail puremagic.com (26/35) Dec 19 2011 http://d.puremagic.com/issues/show_bug.cgi?id=664
- d-bugmail puremagic.com (18/27) Dec 20 2011 http://d.puremagic.com/issues/show_bug.cgi?id=664
- d-bugmail puremagic.com (20/45) Dec 20 2011 http://d.puremagic.com/issues/show_bug.cgi?id=664
- d-bugmail puremagic.com (9/13) Dec 20 2011 http://d.puremagic.com/issues/show_bug.cgi?id=664
- d-bugmail puremagic.com (13/22) Dec 20 2011 http://d.puremagic.com/issues/show_bug.cgi?id=664
- d-bugmail puremagic.com (9/9) Jan 21 2012 http://d.puremagic.com/issues/show_bug.cgi?id=664
- d-bugmail puremagic.com (9/9) Jan 21 2012 http://d.puremagic.com/issues/show_bug.cgi?id=664
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, ...); --
Dec 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
Dec 09 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 "is(... == function)" instead of "is(... == return)" Thanks to Bruno Medeiros for catching this. --
Dec 10 2006
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 d-bugmail puremagic.com schrieb am 2006-12-10:http://d.puremagic.com/issues/show_bug.cgi?id=664"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 -----BEGIN PGP SIGNATURE----- iD8DBQFFfDcsLK5blCcjpWoRAnN5AJ9MX1ROgSUULtT47D1xu8IcdwzOIACeKzG7 snwZR9B8j4jhAOIp5NTs6Fs= =yZ/9 -----END PGP SIGNATURE-----
Dec 10 2006
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 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: -------
Nov 26 2010
http://d.puremagic.com/issues/show_bug.cgi?id=664 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug yahoo.com.au 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: -------
Dec 07 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664 (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: -------
Dec 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664(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: -------
Dec 19 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664How 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: -------
Dec 19 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664It 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: -------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?
Dec 19 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |specComplete section of the spec: ------ 6. is ( Type Identifier == TypeSpecialization ) The condition is satisfied if Type is semantically correct and is the same as TypeSpecialization. The Identifier is declared to be either an alias of the TypeSpecialization or, if TypeSpecialization is dependent on Identifier, the deduced type. If TypeSpecialization is one of typedef struct union class interface enum function delegate then the condition is satisifed if Type is one of those. Furthermore, Identifier is set to be an alias of the type: 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. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------It declares T as a tuple containing all of the function arguments.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?
Dec 19 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664Complete 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: -------
Dec 20 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664I didn't intend to. All discussion has been about is(Type Identifier == function). Sorry that that wasn't clear.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.Yeah, that would work. But it's far more complicated than (1), changing one line of the spec to match the compiler, namely that: is(Type Identifier == function) binds Identifier to: -TypeTuple of the function parameter types +TypeTuple of the function parameter types. For C-style variadic functions, only the non-variadic parameters are included. and then (possibly*) provide some other mechanism for identifying if a function is C-style variadic. is() expressions are just about the ugliest thing in the language already, I'm loathe to recommend making them even uglier. * I say possibly, because I think that given a tuple T and return type R, you can check if typeof(f) == extern(C) R function (T, ...) So I'm not sure that any compiler changes are required. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------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
Dec 20 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664and then (possibly*) provide some other mechanism for identifying if a function is C-style variadic. is() expressions are just about the ugliest thing in the language already, I'm loathe to recommend making them even uglier.Why only C-style variadics? D-style variadics with typeinfo just as well need to be considered. Of course, with typesafe variadics we can feasibly just keep the type and just discard the ... .... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 20 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664You're right. Fortunately, I don't think it's any different. -TypeTuple of the function parameter types +TypeTuple of the function parameter types. For C- and D-style variadic functions, only the non-variadic parameters are included. For typesafe variadic functions, the ... is ignored. Can you improve on that? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------and then (possibly*) provide some other mechanism for identifying if a function is C-style variadic. is() expressions are just about the ugliest thing in the language already, I'm loathe to recommend making them even uglier.Why only C-style variadics? D-style variadics with typeinfo just as well need to be considered. Of course, with typesafe variadics we can feasibly just keep the type and just discard the ... ....
Dec 20 2011
http://d.puremagic.com/issues/show_bug.cgi?id=664 Commit pushed to https://github.com/D-Programming-Language/d-programming-language.org https://github.com/D-Programming-Language/d-programming-language.org/commit/e3ff6bd4a8c6d368a64d6a81af565868f6067c74 fix Issue 664 - is(func T == function) ignores variadic arguments -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 21 2012
http://d.puremagic.com/issues/show_bug.cgi?id=664 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 21 2012