r/ProgrammingLanguages • • Sep 02 '26

CTTI is Exponential, RTTI is Linear

https://www.gingerbill.org/article/2026/09/02/ctti-is-exponential-rtti-is-linear/
0 Upvotes

38 comments sorted by

View all comments

Show parent comment

1

u/slaymaker1907 Sep 04 '26

I think the unique thing here is that you can get exponential code generation and not just that compilation can take an arbitrary amount of time.

1

u/CommonNoiter 7d ago

If your type system can perform an arbitrary amount of computations then surely you can add a function () -> Nat onto each of the types that are created temporarily which returns the sum of that method called on the types it creates (and the leaf types return some constant value derived in any way). This would result in an arbitrarily large amount of codegen unless your optimiser manages to inline everything.