6 ms·
> all functions are dynamically dispatched by default, with inlining being a speculative optimisation Could you please point me to other approaches to inlining
by shadowofneptune 4y ago
> all functions are dynamically dispatched by default, with inlining being a speculative optimisation
Could you please point me to other approaches to inlining? I am also working on a personal language and it could be helpful.
- zesterer 4y agoRust gives each closure a unique type (see the `Fn` trait: https://doc.rust-lang.org/core/ops/trait.Fn.html https://doc.rust-lang.org/core/ops/trait.Fn.html), allowing the compiler to always statically dispatch to the exact function body at compile-time. That said, this is a rather more explicit approach that won't necessarily fit everything.