Topic: Template extension suggestion
Author: jason@cygnus.com (Jason Merrill)
Date: Fri, 3 Feb 1995 09:07:04 GMT Raw View
>>>>> Rizwan Mithani <mithani@i2.COM> writes:
> It is known that templates lead to tremendous proliferation
> of code which in itself is not a significant problem, but
> the state of the art for template instantiation defers
> compilation to link time delaying the detection of even
> simple typographical errors.
The state of the art does not involve delaying the detection of typos until
link time. I believe that compilers exist that check template definitions
when they are seen, modulo semantics dependent on the template parameters.
I couldn't give you names, though. I'm working on implementing this for
g++.
Jason
Author: mithani@i2.COM (Rizwan Mithani)
Date: Thu, 2 Feb 1995 15:10:24 GMT Raw View
It is known that templates lead to tremendous proliferation
of code which in itself is not a significant problem, but
the state of the art for template instantiation defers
compilation to link time delaying the detection of even
simple typographical errors.
To get around this, our group has adopted a thin veneer idiom.
In this idiom to implement Template_Class<T> you derive it
from Template_Base and put all functionality you can at this
level leaving only the type specific stuff at the template
level.
It may be possible for the language to support this idiom
by allowing a template class to indicate that some of its
member functions are not dependent upon the template args
and should be fully compiled at compile time. Any instantiation
would invoke this same code irrespective of the template args.
One suggestion is to use
template<class T> void Template_Class::
to indicate template args independent functions
instead of the usual
template<class T> void Template_Class<T>::
--
--
Rizwan Mithani (Rizwan_Mithani@i2.COM)
I2 Technologies, 1603 LBJ Fwy, 7th Floor, Dallas, TX 75234
-----------------------------------------------------------------
God does not need any money, is not married and can work
atleast six days without sleep; God must be a programmer!