Nim Nuggets: Nim talk at Strange Loop 2021
Walter Bright
newshound2 at digitalmars.com
Sun Oct 17 19:18:25 UTC 2021
On 10/17/2021 3:03 AM, Ola Fosheim Grøstad wrote:
> On Sunday, 17 October 2021 at 08:20:24 UTC, Imperatorn wrote:
>> And still, in 2021 using C++20, compile time features are severely crippled.
>
> How so? Anyway, what Walter said was not accurate. Languages are usually defined
> in a way where compile-time optimizations are optional and an implementation
> detail. Compile time evaluation of functions is nothing new, and a common
> optimization.
You're confusing data flow analysis and function inlining with ctfe. I know how
data flow optimizers work, I was the first to implement one for DOS compilers in
the 80s.
C and C++ compilers have enjoyed the best optimizers in the industry for
decades. But not one of them could compile:
int square(int x) { return x * x; }
const int s = square(2);
Being able to do such NEVER occurred to anyone in the business. It's one of
those ridiculously obvious things that nobody thought of for decades. It's so
obvious people today cannot even conceive of not thinking of it.
I developed compilers with optimizers for 20 years before it occurred to me.
Implementing it around 2007, it was like a bomb went off in the D community.
(Don Clugston was the first to recognize what it could do.) From there it spread
to C++ and pretty much every other compiled language.
More information about the Digitalmars-d
mailing list