ocaml-ppx / ppx_tools

Tools for authors of ppx rewriters
MIT License
134 stars 39 forks source link

Add string delimiter compatibility wrapper. #36

Closed aantron closed 8 years ago

aantron commented 8 years ago

Would be quite helpful for https://github.com/ocsigen/tyxml/pull/89. In particular, see: https://github.com/ocsigen/tyxml/blob/ppx/ppx/ppx_tyxml.ml#L177

alainfrisch commented 8 years ago

Ok in principle, but the name is not very explicit. What about quotation_delimiter, as used in Ast_helper.Const.string?

Drup commented 8 years ago

I think we should rather add a get_full_str that would return both the string and the delimiter. You usually want both at the same time and the multiple option wrapping are a bit annoying.

aantron commented 8 years ago

Will change it to whatever we agree on. I'm fine with changing the name and combining with retrieving the string, but what do you think @alainfrisch?

alainfrisch commented 8 years ago

My proposal:

val get_str_with_quotation_delimiter: expression -> (expression * string option) option

The name is long, but more explicit than get_full_str; and we don't want to encourage too much ppx authors to depend on the quotation delimiter (which, in its original design at least, is supposed to be purely syntactic).

Drup commented 8 years ago

Works for me.

aantron commented 8 years ago

Updated, assuming you meant (string * string option) option for the result type.