digitalmars.D.bugs - [Issue 493] New: Partial IFTI does not work
- d-bugmail puremagic.com (51/51) Nov 09 2006 http://d.puremagic.com/issues/show_bug.cgi?id=493
- d-bugmail puremagic.com (9/9) Feb 20 2008 http://d.puremagic.com/issues/show_bug.cgi?id=493
- d-bugmail puremagic.com (19/21) Feb 20 2008 http://d.puremagic.com/issues/show_bug.cgi?id=493
- d-bugmail puremagic.com (5/5) Feb 20 2008 http://d.puremagic.com/issues/show_bug.cgi?id=493
- d-bugmail puremagic.com (7/7) Mar 06 2008 http://d.puremagic.com/issues/show_bug.cgi?id=493
- d-bugmail puremagic.com (8/8) May 18 2008 http://d.puremagic.com/issues/show_bug.cgi?id=493
- d-bugmail puremagic.com (12/12) Aug 09 2008 http://d.puremagic.com/issues/show_bug.cgi?id=493
- d-bugmail puremagic.com (5/5) Nov 13 2008 http://d.puremagic.com/issues/show_bug.cgi?id=493
- d-bugmail puremagic.com (4/4) Dec 01 2008 http://d.puremagic.com/issues/show_bug.cgi?id=493
- d-bugmail puremagic.com (5/6) Dec 01 2008 http://d.puremagic.com/issues/show_bug.cgi?id=493
- d-bugmail puremagic.com (6/6) Dec 10 2008 http://d.puremagic.com/issues/show_bug.cgi?id=493
- d-bugmail puremagic.com (9/9) Dec 25 2008 http://d.puremagic.com/issues/show_bug.cgi?id=493
http://d.puremagic.com/issues/show_bug.cgi?id=493 Summary: Partial IFTI does not work Product: D Version: 0.173 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: wbaxter gmail.com IFTI should try to deduce the parameter types for any template paramters not specified (if they don't have defaults). -------- import std.stdio:writefln; template foo(T,S) { void foo(T t, S s) { writefln("typeof(T)=",typeid(typeof(T))," typeof(S)=",typeid(typeof(S))); } } template bar(T,S) { void bar(S s) { writefln("typeof(T)=",typeid(typeof(T))," typeof(S)=",typeid(typeof(S))); } } void main() { // OK -- IFTI works happily foo(1.0,33); // OK -- Full template parameters specified bar!(double,int)(33); // error: I gave it T and it should be able to use IFTI to guess S, but it doesn't //bar!(float)(33); } --------------- Not sure if this should be a bug or an enhancement, but anyway, especially with the new variadic templates I think it will become more common to want to have a few specified paramters and let IFTI guess the rest. templatefunc(T, Var...)(Var v) { [...] } templatefunc!(SomeType)(a,b,c,d,e); This basically isn't usable if I have to specify all the types for a,b,c, and d. --
Nov 09 2006
http://d.puremagic.com/issues/show_bug.cgi?id=493 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED DMD 2.011 was enhanced to do this. --
Feb 20 2008
http://d.puremagic.com/issues/show_bug.cgi?id=493 wbaxter gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |DMD 2.011 was enhanced to do this.And this isn't a bug in D1 because...? As far as I can tell, the spec says only this about IFTI: """ Function templates can be explicitly instantiated ... or implicitly, where the TemplateArgumentList is deduced from the types of the function arguments """ It doesn't say anything about only working when it's convenient or when the stars are aligned properly. The conclusion I draw is that any failure to deduce a type when the information required to deduce it is there is a bug. --
Feb 20 2008
http://d.puremagic.com/issues/show_bug.cgi?id=493 By the way, that's great that it's fixed in D2. I can confirmed that it does indeed work with 2.011 (but not with 1.075). --
Feb 20 2008
http://d.puremagic.com/issues/show_bug.cgi?id=493 The new std.algorithm in DMD 2.011 uses this capability heavily. That means porting std.algorithm to D1 is basically not practical as of D2.011. I'm really going to be bummed if you hold to the line that fixes like this are really "enhancements" that will not be ported to D1. --
Mar 06 2008
http://d.puremagic.com/issues/show_bug.cgi?id=493 This is a bug in DMD 1.0 so I'm sure it will be fixed eventually. And since basically all real development is with D 1.0, I sincerely hope we don't have to wait forever. This ticket was originally filed in 2006. It would be nice if the D book requires it to work correctly. --
May 18 2008
http://d.puremagic.com/issues/show_bug.cgi?id=493 ------- Created an attachment (id=267) --> (http://d.puremagic.com/issues/attachment.cgi?id=267&action=view) Patch to backport partial IFTI to dmd. Against llvmdc's dmd frontend. Should be similar to dmd 1.033. I only did basic testing, but this patch seems to backport the D2 partial IFTI changes to D1. Should this go into llvmdc proper though? If we start diverging from Walter's definition of D1 too much we'll essentially create a D 1.5... People using this feature on llvmdc couldn't switch back to dmd easily. --
Aug 09 2008
http://d.puremagic.com/issues/show_bug.cgi?id=493 I don't think is a good idea either to make ldc as buggy as DMD just to be compatible =) --
Nov 13 2008
http://d.puremagic.com/issues/show_bug.cgi?id=493 It's the very purpose of compatibility to replicate bugs. --
Dec 01 2008
http://d.puremagic.com/issues/show_bug.cgi?id=493It's the very purpose of compatibility to replicate bugs.No, the very purpose of compatibility is to replicate *features*! --
Dec 01 2008
http://d.puremagic.com/issues/show_bug.cgi?id=493 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement --
Dec 10 2008
http://d.puremagic.com/issues/show_bug.cgi?id=493 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED Added to dmd 1.038 --
Dec 25 2008