Adding Java and C++ to the MQTT benchmarks or: How I Learned to Stop Worrying and Love the Garbage Collector

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Jan 8 15:01:29 PST 2014


On Wed, Jan 08, 2014 at 11:23:50PM +0100, Benjamin Thaut wrote:
> Am 08.01.2014 21:57, schrieb H. S. Teoh:
[...]
> >I find the lack of strong metaprogramming capabilities in Java (never
> >tried C# before) a show-stopper for me. You have to resort to either
> >lots of duplicated code, or adding too many indirections that hurts
> >performance.  For compute-intensive code, too many indirections can
> >mean the difference between something finishing in 2 days instead of
> >2 hours.
> >
> 
> I fully agree here. Still when choosing a programming language you
> also have to pick one that all programmers on the team can and want to
> use. I fear that the D metaprogramming capabilities will scare of
> quite a few programmers because it seems to complicated to them.  (Its
> really the same with C++ metaprogramming. Its syntactically ugly and
> verbose, but gets the job done, and is not so complicated if you are
> familiar with the most important concepts).

Coming from a C++ background, I have to say that C++ metaprogramming,
while possible, is only so in the most painful possible ways. My
impression is that C++ gave template metaprogramming a bad name, because
much of the metaprogramming aspects of templates were only discovered
after the fact, so the original design was never intended to be used in
the way it's used nowadays. As a result, people associate the design
flaws in C++ templates with template programming and metaprogramming in
general, whereas such flaws aren't an inherent feature of
metaprogramming itself.

Unfortunately, this makes people go "ewww" when they hear about D's
metaprogramming, whereas the real situation is that metaprogramming is
actually a pleasant experience in D, and very powerful if you know how
to take advantage of it.

One thing I really liked about TDPL is that Andrei sneakily introduces
metaprogramming as "compile-time parameters" early on, so that by the
time you get to the actual chapter on templates, you've already been
using them comfortably for a long time, and no longer have an irrational
fear of them.


T

-- 
Without geometry, life would be pointless. -- VS


More information about the Digitalmars-d mailing list