[wg-camlp4] Reconciling Merlin and ppx

Alain Frisch alain.frisch at lexifi.com
Mon Nov 4 14:06:18 GMT 2013


On 11/04/2013 02:46 PM, Frédéric Bour wrote:
> Merlin is used in an interactive context (were we expect a response in
> less than ~ 60ms, on average).
>
> If we retransform the whole AST during each invocation, we also need to
> retype the whole AST after.

I assume there is already some logic to detect from which point the code 
has changed, and to resume type-checking from the start of the phrase, 
using some kind of snapshot.  Couldn't this logic be applied after the 
preprocessing?

Still, calling the PPX transformers as external processes might already 
be too slow (there is always the option to link them in).

 > Then an "open Core.Std" alone is enough to
> blow up the time budget. (And this existimation is done on a desktop
> computer, some users have EEE).

For this specific example, this patch might help:

http://caml.inria.fr/mantis/view.php?id=5916

(I'm still waiting for a reproducible case before accepting the patch...)

> However, I wonder how this state threading would be handled in the REPL ?

Currently, it's not.  See:

http://caml.inria.fr/mantis/view.php?id=5904#c8797


Even though some rewriters might need to maintain state (or even have 
access to the whole unit), many of them (and in particular those 
corresponding to the extensions currently supported by Merlin) won't 
probably need it.


Alain


More information about the wg-camlp4 mailing list