Does dmd not always compile all of the source code?
Atila Neves
atila.neves at gmail.com
Wed Dec 6 20:12:57 UTC 2017
On Wednesday, 6 December 2017 at 19:40:49 UTC, A Guy With a
Question wrote:
> On Wednesday, 6 December 2017 at 19:19:09 UTC, A Guy With a
> Question wrote:
>> It seems D's fast compile times are achieved by skipping
>> semantic checking and even parsing when it doesn't feel it's
>> needed. I strongly disagree with this decision. This could
>> leave complex dormant time bombs that break builds
>> unexpectedly and even accidentally. It's understandable in
>> certain situations where there is enough information, but the
>> first step to testing code, is first making sure it
>> compiles...I don't want the compiler making decisions on what
>> is worthy to compile. If I pass a d source file into it, I
>> want to know if it's valid. This is unfortunate. This might be
>> a deal breaker for me.
>
> I'm very concerned of working with a language that, at minimum,
> doesn't let me know if a file I passed in even contains valid
> code.
It does let you know if it contains valid code - if you're
actually building it.
If you write unit tests but never compile them in, whether or not
they make any sense is IMHO irrelevant. If you write a template
and never instantiate it, does it make a sound?*
Imagine this:
version(Windows) int i = 0;
else foobarbaz;
Should it fail to compile on Linux? How is this any different
from:
#ifdef _WIN32
int i = 0;
#else
ohnoes
#endif
As noted by others, C++ templates work similarly. And for good
reason!
Atila
* https://en.wikipedia.org/wiki/If_a_tree_falls_in_a_forest
More information about the Digitalmars-d-learn
mailing list