[wg-camlp4] Reconciling Merlin and ppx

François Bobot francois.bobot at cea.fr
Mon Nov 4 16:06:44 GMT 2013


On 04/11/2013 16:15, Gabriel Scherer wrote:
>> Ok. So if some work had to be done to ensure proper compatibility between
>> merlin and ppx, it would be for supporting stateful rewriters.
>
> I think we should consider making statefulness explicit in the
> rewriters API, that is asking stateful rewriter to use a marshallable
> state type and express their transform in the state monad (state * AST
> -> state * result), instead of silently initializing internal state.
> This would be compatible with an imperative style in the code of the
> rewriter themselves (you just need to reify the state at the end of
> the transformation).
>

It is a nice idea to explicit the state but I'm not sure it is 
compatible with an imperative style since merlin needs a persistent 
state between every declaration. Since merlin needs only to backtrack, 
it is sufficient for the rewriters to give a push/pop interface.

-- 
François



More information about the wg-camlp4 mailing list