Nobody understands templates?
H. S. Teoh
hsteoh at quickfur.ath.cx
Tue Mar 4 07:50:56 PST 2014
On Tue, Mar 04, 2014 at 10:32:52AM +0000, Chris wrote:
[...]
> Maybe that's why it is so hard to see the benefits of templates,
> because many cases (of abstraction) are already covered by OOP. I
> like templates, but I'm not sure if they are as useful as D's
> ranges. Ranges and component programming handle the ubiquitous
> input>filter>output paradigm present in every program and help to
> break down the program's logic into digestible chunks, a logic you
> cannot just copy and paste (but you can reuse the chunks). In cases
> where you use templates, you can also get away with copy and paste
> and replace "int" with "double".
[...]
Ranges in D will be nowhere as convenient as they are today without
templates. When you write your own components, you basically have to use
templates in order to not incur unacceptable overhead (or impose
arbitrary limitations on usage -- such as requiring something to be
derived from some chosen base class).
T
--
Never ascribe to malice that which is adequately explained by
incompetence. -- Napoleon Bonaparte
More information about the Digitalmars-d-learn
mailing list