Compile time vs run time -- what is the difference?

thebluepandabear therealbluepandabear at protonmail.com
Wed Dec 28 02:31:45 UTC 2022


I am reading through the free book on learning D by Ali Çehreli 
and I am having difficulties understanding the difference between 
compile time execution and run time execution in D language.

What I do understand is that compile time and run time are the 
two processes that your code goes through to be executed 
natively. Compile time is the first stage. During compile time, 
the compiler checks for basic syntax errors such as a missing 
semicolon, typos throughout the codebase. Then the run time stage 
begins. Other errors are only able to be spotted during run time 
such as exceptions, dividing by zero, assert blocks.

In Java and some other languages, during compile time the code 
gets executed into Java bytecode. This also happens for C#. I 
don't know if there is an equivalent 'intermediate' language for 
D that your code gets translated to.

In general, I have a very vague understanding of these concept.s 
I don't understand the basics of how compile time and run time 
works in D language, it wasn't really explained in the book so 
when I see terms like 'compile time' and 'run time' I only have a 
very vague idea of what these things mean and how the process 
works for D language when compared to other high level languages.

Any help would be appreciated.



More information about the Digitalmars-d-learn mailing list