Nim Nuggets: Nim talk at Strange Loop 2021

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Oct 18 10:50:15 UTC 2021


On Monday, 18 October 2021 at 06:48:25 UTC, Patrick Schluter 
wrote:
> put the square function in another compilation unit (i.e. its 
> source is not available), and see if it can optimize it. ;-)
> That's the difference between CTFE and inlining.

There were C/C++ compilers that did whole program optimization 
(IR) in the 90s, but the key difference between optimization of 
function calls and compile time function evaluation is when the 
evaluation affects the type. (enum being one simple example, 
static array length being another). In this case it has to be 
required by the language, so it is no longer an implementation 
detail.





More information about the Digitalmars-d mailing list