
Caching D compiler – preview version - arunc
https://forum.dlang.org/post/laudvmdabysfmjasztkj@forum.dlang.org
======
WalterBright
Dmitry Olshansky has written an experimental extension to the D compiler to
cache the results of CTFE (compile time function evaluation) between compiles.
CTFE started out as just a more capable constant folder, but has evolved into
a way to run arbitrarily complex programs at compile time. It's used to
generate regex machines and grammar parsers, for example. These can slow down
compilation significantly, so the idea with the cache is to remember previous
results to avoid recomputation.

------
katastic
I've genuinely enjoyed switching to D for hobby game projects. There's some
new problems that I haven't quite figured out (like GC allocations ONLY occur
at specific points, however, ANY GC could still blow up ANY object which means
if you're not careful, you've added an entire dimension to problem solving
over that of a C++ project when a finalizer gets called and does something it
shouldn't.)

On the otherhand, ranges, native strings, an insanely straight-forward and
powerful template engine, compile-time evaluation, native contract programming
and unit testing, modules (read: what's a header guard?), make C++ feel like
clanging rocks together to make fire compared to D. Actual direct support for
multi-dimensional arrays without insane levels of nested template boilerplate
code is worth the price of admission alone.

I could honestly go on for paragraphs listing just the features I use on a
regular basis that don't exist in C++. C++ is basically "D, a decade behind."
Because half the greatest features they're adding to C++ have already been in
D for at least a decade.

C++ _finally_ added numeric separators (that Motorola C had ... in the 90's?
Or earlier?) 1 million is 1_000_000, not 1000000. Surely, there's no chance of
user error in the second version! (Be honest, how many times did your eyes
check to see if the second number actually added to a million or had a typo?)

And I say this as someone who programmed C++ for decades until I found D.
_It's by no means perfect_, but it's sure of a lot more enjoyable to program
in.

~~~
DmitryOlshansky
This is one good description of what D feels like. Something that C++ is
slowly adopting from except that it can’t get rid of the old cruft.

D at the moment is a the most flexible and powerful tool to build something
from scratch. If you care about performance ;)

It’s not a ready as a “platform” though, you are still expected to build quite
a few things that are usually taken for granted on your own.

------
mnembrini
How does this compare to something like ccache?

~~~
fasquoika
I'm not too familiar with ccache, but I assume it caches files? This compiler
caches expressions, so you can change parts of a file without affecting the
cache

