[erlang-questions] scope of variables

Richard Carlsson <>
Sat Sep 30 13:12:03 CEST 2006


Vlad Dumitrescu wrote:
> That's cool to know! However, if one needs something less simple than
> just loop unrolling, then another approach is needed.
> 
> A few other applications of this "compile a customized variant of this
> function given these static parameters" could be
> 
> * sparse vector multiplication, where all zero elements would just
> eliminated from the calculation
> * regexps, where it is possible (but I'm not sure if it applies to the
> general case) to generate specializations of the generic algorithm
> that are very close to hand-crafted variants.

Yes, the inliner is not a full partial evaluator. Still, it can do
quite a lot of specialization on the code that it decides to inline.
(It's a really cool algorithm, much better than traditional inliners.)

    /Richard



More information about the erlang-questions mailing list