3 ms·
> Yep. Unlike some other languages, the vast majority of calls in Rust are static rather than dynamic (even moreso than C++), which averts the problem from the
by kibwen 11y ago
> Yep.
Unlike some other languages, the vast majority of calls in Rust are static rather than dynamic (even moreso than C++), which averts the problem from the outset. And even then, LLVM is still capable of AOT devirtualization. It's very rare to reach for a trait object rather than a bounded generic, so I'm afraid that categorizing bounded generics as a "weak abstraction" is hyperbolic on your part. :)
> a JIT can do this
Constant folding is hardly the exclusive purview of JIT. :P When coming up with the above example I had to repeatedly jump through hoops in order to keep LLVM from statically evaluating the entire function; even when I managed to force LLVM to stop inlining the function, it went behind my back and propagated the constant into the uninlined function, creating a symbol that did nothing other than return the integer 5050. :P
- pron 11y ago> I'm afraid that categorizing bounded generics as a "weak abstraction" is hyperbolic on your part. Yeah, probably. > Constant folding is hardly the exclusive purview of JIT. Oh, sure, but in that example, an AOT would have a hard time doing that (certainly without special rules).