Inlining Ref Functions

dsimcha dsimcha at yahoo.com
Sun May 17 11:07:40 PDT 2009


== Quote from Bill Baxter (wbaxter at gmail.com)'s article
> Performance is one of the major selling points of D.  Why settle for a
> language with sub-standard tools and lack of safety if you don't care
> about performance?  If you don't care about performance you're
> probably better off with one of those languages that runs on the JVM
> or CLR.
> --bb

But JVM and CLR languages either are orders of magnitude slower than D (the
dynamic ones) or are statically typed and don't have the insane metaprogramming
capabilities of D.  IMHO the biggest single selling point of D, D2 at least, is
its metaprogramming.  This allows one to have a statically typed language, meaning
good performance (even if current implementations are slightly slower than C++,
the difference between D vs. Python or Perl is much greater than D vs. C++ or raw,
inscrutable hexadecimal numbers) and compile time checking while still being able
to design flexible APIs.

IMHO (honestly not that informed since I've barely used Java, mostly a gut
feeling) Java APIs feel so ridiculously overengineered because, with static typing
and no metaprogramming, there's no other way to build flexibility into the system
besides going overboard on the OO design.  When your only tool is the virtual
function call, everything starts to look like a virtual hammer.  D APIs, on the
other hand, can be very flexible *and* simple.

std.algorithm and std.range are good examples, but since they were written by a
metaprogramming uber-guru and the language was designed specifically to
accommodate them, they might not be that representative.  However, even for
dstats, which is written by a relative amateur and did not have the luxury of
having parts of the core language designed around it, I cringe when I think about
what I'd have to do in Java to make it as flexible as it is, and API design for a
statistics library is probably one of the easier cases.



More information about the Digitalmars-d mailing list