digitalmars.D - Suggestion: auto templates
- bobef <bobef lessequal.com> Feb 19 2006
- Trevor Parscal <Trevor_member pathlink.com> Feb 19 2006
- bobef <bobef lessequal.com> Feb 19 2006
- Hasan Aljudy <hasan.aljudy gmail.com> Feb 19 2006
- bobef <bobef lessequal.com> Feb 19 2006
- nick <nick.atamas gmail.com> Feb 19 2006
- Sean Kelly <sean f4.ca> Feb 19 2006
It would be nice if there were something like auto templates. I.e. if we
have something like:
template mytemplate(_type)
{
int foo(_type[] ar);
int boo(_type ar);
}
and type something like
char[] a;
foo(a);
//or even
mytemplate.boo(a[0]);
DMD could autodetect the type and we won't need to specify the type
every time manualy.
Feb 19 2006
In article <dt9fqs$1v1h$1 digitaldaemon.com>, bobef says...It would be nice if there were something like auto templates. I.e. if we have something like: template mytemplate(_type) { int foo(_type[] ar); int boo(_type ar); } and type something like char[] a; foo(a); //or even mytemplate.boo(a[0]); DMD could autodetect the type and we won't need to specify the type every time manualy.
This is a bit ambiguous in actual practice IMHO - but... I also can see how this would be awesome - when this ambiguity would be desired. Thanks, Trevor Parscal
Feb 19 2006
Trevor Parscal wrote:In article <dt9fqs$1v1h$1 digitaldaemon.com>, bobef says...It would be nice if there were something like auto templates. I.e. if we have something like: template mytemplate(_type) { int foo(_type[] ar); int boo(_type ar); } and type something like char[] a; foo(a); //or even mytemplate.boo(a[0]); DMD could autodetect the type and we won't need to specify the type every time manualy.
This is a bit ambiguous in actual practice IMHO - but... I also can see how this would be awesome - when this ambiguity would be desired. Thanks, Trevor Parscal
I mean the same way it is possible to write auto a=6;
Feb 19 2006
bobef wrote:It would be nice if there were something like auto templates. I.e. if we have something like: template mytemplate(_type) { int foo(_type[] ar); int boo(_type ar); } and type something like char[] a; foo(a); //or even mytemplate.boo(a[0]); DMD could autodetect the type and we won't need to specify the type every time manualy.
is this the infamouse implicit template instantiation?
Feb 19 2006
Hasan Aljudy wrote:bobef wrote:It would be nice if there were something like auto templates. I.e. if we have something like: template mytemplate(_type) { int foo(_type[] ar); int boo(_type ar); } and type something like char[] a; foo(a); //or even mytemplate.boo(a[0]); DMD could autodetect the type and we won't need to specify the type every time manualy.
is this the infamouse implicit template instantiation?
I don't know.
Feb 19 2006
It's a variation on it. bobef wrote:Hasan Aljudy wrote:bobef wrote:It would be nice if there were something like auto templates. I.e. if we have something like: template mytemplate(_type) { int foo(_type[] ar); int boo(_type ar); } and type something like char[] a; foo(a); //or even mytemplate.boo(a[0]); DMD could autodetect the type and we won't need to specify the type every time manualy.
is this the infamouse implicit template instantiation?
I don't know.
Feb 19 2006
Hasan Aljudy wrote:bobef wrote:It would be nice if there were something like auto templates. I.e. if we have something like: template mytemplate(_type) { int foo(_type[] ar); int boo(_type ar); } and type something like char[] a; foo(a); //or even mytemplate.boo(a[0]); DMD could autodetect the type and we won't need to specify the type every time manualy.
is this the infamouse implicit template instantiation?
Pretty much. Sean
Feb 19 2006









bobef <bobef lessequal.com> 