Why C++ compiles slowly

dsimcha dsimcha at yahoo.com
Thu Aug 19 13:31:32 PDT 2010


== Quote from retard (re at tard.com.invalid)'s article
> Thu, 19 Aug 2010 15:52:25 -0400, bearophile wrote:
> > dsimcha:
> >> What D gets right is that you shouldn't have to be burdened with it
> >> when you don't need it, and the simple, clean, safe way that works most
> >> of the time should be the idiomatic way, but the
> >> ugly/unsafe/inconvenient way that works in the corner cases should be
> >> available, even if no serious effort is put into making it not
> >> ugly/unsafe/inconvenient.
> >>
> >> Languages like C++ and Java tend to ignore the simple, common case and
> >> force you to do things the hard way all the time, even when you don't
> >> need the benefits of doing things the hard way.  Thus, these languages
> >> are utterly useless for anything but huge, enterprisey projects.
> >
> > When you compile a Java program the compiler is able to find and fetch
> > the files it needs. DMD isn't able to. So Java is more handy for small
> > projects composed of something like 10-20 files. So I don't agree with
> > you. (It's a feature I've asked for in my second message on the D
> > newsgroups.)
> Having written several university assignments in Java, small (< 500 LOC)
> to medium size (50000 LOC), I haven't encountered a single compilation
> related problem. One exception to this are some bindings to native code
> libraries -- you need to be careful with URLs when packaging external
> libraries inside a JAR.
> The class centric programming paradigm often gets in your way when
> programming in the small, but it's quite acceptable on large scale IMO.
> How is Java so utterly useless and D much better? Any use cases?

I didn't mean my comment in terms of the compilation system.  I meant it as a more
general statement of how these languages eschew convenience features.  Examples:

The class centric paradigm is one example.

The ridiculously fine grained standard library import system.  If you really want
to make your imports this fine-grained, you should use selective imports.

Strictly explicit, nominative typing.

Lack of higher order functions and closure just because you **can** simulate these
with classes, even though this is horribly verbose.

No RAII, scope statements, or anything similar just because you **can** get by
with finally statements, even though this is again horribly verbose, error-prone
and unreadable.

The requirement that you only have one top-level, public class per file.

Lack of default function arguments just because these **can** be simulated with
overloading, even though this is ridiculously verbose.

Lack of operator overloading just because you **can** use regular method calls,
even though properly used operator overloading makes code much more succinct and
readable.


More information about the Digitalmars-d mailing list