Nobody understands templates?
Chris
wendlec at tcd.ie
Tue Mar 4 10:19:38 PST 2014
On Tuesday, 4 March 2014 at 15:52:37 UTC, H. S. Teoh wrote:
> 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
True, true. The fact that the compiler can check for the right
types is great.
Btw, the quote you have in this post:
Never ascribe to malice that which is adequately explained by
incompetence. -- Napoleon Bonaparte
I'm surprised that Napoleon would say something like this. Malice
is often a characteristic of the incompetent. The only way to get
the better of their betters. :-)
More information about the Digitalmars-d-learn
mailing list