[wg-camlp4] My uses of syntax extension

Hongbo Zhang hongboz at seas.upenn.edu
Mon Jan 28 14:47:18 GMT 2013


Hi Alain,
   Is there any chance to see your current work to decide how hard it
would be to adapt p4 to your new syntax?
  Btw: do you have a clear idea how to implement ast lifting in ppx(
the meta filter in p4) which is an essential part in
quasi-quotation?(the stream parsers have non-trivial optimizations
which depends on it )
On Mon, Jan 28, 2013 at 9:33 AM, Alain Frisch <alain at frisch.fr> wrote:
> On 01/28/2013 02:06 PM, Török Edwin wrote:
>>
>> Backward compatibility would be appreciated, especially for something as
>> simple as IFDEF.
>
>>...
>
>> Thinking about backward compatibility again perhaps there should be more
>> transformation phases:
>
>
> Backward compatibility is an important topic, since the goal of this working
> group is to propose a migration plan.
>
> My personal view is that we should not complexify our "target" (-ppx) only
> to support backward compatibility.  Clearly, -ppx will require some
> user-visible changes, since it is no longer an option to change the concrete
> syntax.  To take a concrete example, what should a project like js_of_ocaml
> do, once they have a fully functional -ppx version?
> An option could be to keep maintaining their camlp4 extension in parallel,
> but extend it to support for the syntax chosen for the -ppx version.  The
> only benefit of it is that users stuck with older versions of ocaml can
> still move smoothly to the new syntax, so as to be ready to get rid of
> camlp4 at some point.  Other users don't need that: they can rewrite their
> project progressively (e.g. module per module) using both the camlp4 syntax
> extension and the -ppx rewriter, and then stop using camlp4 when everything
> has been rewritten.  Is it worth the effort to adapt the camlp4 extension to
> match the new syntax?  It's probably up to each project maintainer to decide
> (considering that supporting several versions of camlp4 is also quite
> challenging).  Who is really stuck with old versions of ocaml (and still
> wanting and able to use new versions of packages)?
>
>
>> Also it'd be nice to have:
>>   -ppt Typedtree -> Typedtree for type-level transformations
>
>
> I don't believe this is a viable option.  Producing Typedtree without
> breaking invariants of the type system (and the type soundness) is extremely
> challenging.  I'd be more comfortable with supporting a "Typedtree ->
> Parsetree" pass, where you'd only need to be able to use information from
> the typedtree so as to produce fragments of code which are then type-checked
> again.  You don't need to fully understand everything in the Typedtree to do
> that, and the type-checker acts as a safety net.
>
> OCamlPro worked on a project called "OCaml Templates" doing exactly that,
> but I don't know the status of this project.  (Someone from OCamlPro to
> comment?)
>
>
> Alain
>
>
>
> _______________________________________________
> wg-camlp4 mailing list
> wg-camlp4 at lists.ocaml.org
> http://lists.ocaml.org/listinfo/wg-camlp4



-- 
-- Regards, Hongbo


More information about the wg-camlp4 mailing list