On Sunday, 25 November 2018 at 22:00:21 UTC, Chris Katko wrote:.
So 1) I have to compile manually, then link. Except that also
runs the files every time even if they're up-to-date. Is that
normal behavior for C/C++?
Well you dont have to use separate commands but yes compiling and
linking are two steps and its normal behavior for all native
languages. Each OS have their own linker and we dont control that.
Two questions/topics/issues:
-------------------------------------------------------
#1 How to I only build files that are dirty? Do I actually need
a build program like DUB, MAKE, or CMAKE to do that? (Can make,
cmake be used?) How do they recognize files are out-dated if
DMD can't? Is that just an industry-standard
specialization/separation-of-responsibilities to not have the
compiler auto-detect up-to-date builds?
Yes its separation of responsibilities and there are many tools
to automate that. Take a look at rdmd
"rdmd recompiles files only on a needed basis, e.g. two
invocations of rdmd in sequence without an intervening change to
any relevant source file does not produce the executable again."
https://dlang.org/rdmd.html
If dub or rdmd doesnt satisfy your needs then you will need to
learn other build system.
I have to tell you that, as an outsider (who is VERY interested
in D), this is very frustrating. "Compile times are fast" !=
"build times" is a huge misconception that borders on being a
clever lie or twisting of words. When people hear "compile
times", they think "time to compile the whole project" not
"time to compile a simple test case that doesn't use any
typical D features--also, it's not linking." Second, as shown
here, it's not fast even for compiling! Because the second you
touch std.regex (which has NO WARNINGS in the documentation),
you're greeted with another clever lie-by-omission: a 10x
explosion of build time over some modules.
Yes D have some rough spots thats for sure. For compile times
these include std.regex, std.format and heavy CTFE use. There is
newCTFE engine that is faster but its not ready yet. That said D
code compiles faster than C++ and Rust. To really put fast into
perspective read this
https://news.ycombinator.com/item?id=18442941
So my point is, I keep running into either misconceptions that
conveniently make D look good, and other gotchas with NO
DOCUMENTATION that make the language much slower to work with
than expected.
People who advertise languages talk about positives and leave out
negatives. One thing you need to know - D doesnt have huge
sponsor and some places might be rough because of it. Currently
core dev team focus more on stability and bug fixes than build
speeds. I think you rather have compiler that works than compiler
that crashes 1 sec faster.
Its not all negatives with regex. Current regex implementation is
one of the fastest in the world. Thats classic D trade of - you
spend compile time for better runtime.
I mean, can you think of any module in the Python/Javascript/C#
standard library that simply including it will swell your
program to the point it can't compile?
Have you tried C++ boost?