I have a few T/F questions about ppx derivers vs rewriters.
-
ppx derive = keep old AST in place, we inject new AST
-
ppx rewriter = delete old AST, inject new AST
-
all ppx derivers can be written as ppx rewriters (at the cost of not composing well)
-
not all ppx rewriters can be written as ppx derivers
so why do we have ppx derivers at all, is the main benefits:
-
ppx derivers is a compiler enforced contract of “this old AST stays in place”
-
because old AST remains in place and we only add new things, ppx derive composes well, i.e. [@@deriving ppx1, ppx2, ppx3] – this guarantees, up to naming conflict issues, that ppx1, ppx2, ppx3 will not cause problems for each other
Is the above correct? Is there any other benefit to having this deriver / rewriter split ?
Thanks!