OCamlPro / flambda-task-force

13 stars 1 forks source link

Pure function application lifting #139

Open chambart opened 8 years ago

chambart commented 8 years ago

With modular implicits, it will be important to be able to lift functor applications to toplevel even when not inlining, and allow sharing of such expressions.

This could be done as a special case of constant lifting and constant sharing.

Note that if the function is inlined there may be some way to share the values, but this would rely on being able to share equal functions. This means that for such functor applications lifting and sharing should happen before inlining as this would make it easier to guaranty that the sharing happen and reduce the inlining cost (in compile time).

In some case, it would even be possible to know that a functor application is pure, even when the function value couldn't be propagated, for instance if the functor comes from a first class module provided at run-time while still having an implicit argument, ensuring purity.

mshinwell commented 8 years ago

Maybe for 4.05