Search code examples
compiler-constructionruntimecompile-timelow-level

Why Was The Runtime Introduced?


With super low level languages like Assembly there's no runtime but with anything else that's actually being used frequently like Rust, C, C++, C#, Java, Kotlin, Swift, etc there's a runtime that goes with the language. Why isn't everything done at compile time with these languages? Is it just because it'd be harder to do than using a runtime or is there some actual benefit to having a runtime?


Solution

  • Well, no there isn't a 'runtime' with C or C++ as they are fully compiled languages. Other languages are interpreted - essentially the runtime as you call it is like super microcode in the processor that interprets statements in Java, PHP, BASIC, or what have you, and translates them to machine code at run time.

    As to why this is done - well, to make code development faster I suppose. I am not sure that is as much a factor today as it used to be back in the days of a 4MHz z80!!!

    I hope other people will add comments as this is actually an interesting question