Re:Caching D compiler – preview version
by WalterBright on Saturday October 28, 2017 @04:55PM
(#15576729)
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.
Re:Caching D compiler – preview version
by katastic on Sunday October 29, 2017 @12:46AM
(#15577995)
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.
Re:Caching D compiler – preview version
by fasquoika on Saturday October 28, 2017 @04:41PM
(#15576690)
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
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.
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.