Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type safe templating (with mustache) #128

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Type safe templating (with mustache) #128

wants to merge 8 commits into from

Conversation

Drup
Copy link
Member

@Drup Drup commented Apr 18, 2016

This is WIP.

open Tyxml

let%template f ={|
Hello {{name}}, You are {{{desc}}}
{{#list}}
  <b>{{foo}}</b> {{name}}
{{/list}}
{{^list}}
  No foos :(
{{/list}}
|}

val f :
  name:bytes ->
  list:< foo : bytes; .. > list ->
  desc:([> `B | `PCDATA ] as 'a) Tyxml_html.elt list ->
  'a Tyxml_html.elt list

Current issues:

  • Locations are completely lost (because of the mustache implementation)
  • Nesting is untested
  • Can't specify a name relative to the current context. Names are always resolved from the top context.

@aantron
Copy link
Contributor

aantron commented Apr 19, 2016

I think this is (potentially) a great idea, but I don't think TyXML should offer two PPXs as in the attached commits. Ideally, there would be "one great TyXML PPX" that offers this and whatever other features. Otherwise, we are likely to confuse new users and make them anxious about going down the wrong path with their code.

@Drup
Copy link
Member Author

Drup commented Apr 16, 2018

If people want this to happen, please voice your opinion on the choice of the templating language in https://discuss.ocaml.org/t/choice-of-template-language-for-tyxml/1863 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants