caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Vincent Balat <vincent.balat@pps.jussieu.fr>
To: caml-list@yquem.inria.fr
Cc: Thomas.Gazagnaire@sophia.inria.fr,
	"Raphael Proust" <raphlalou@gmail.com>
Subject: Re: [Caml-list] [Camlp4] Quotation expander with OCaml syntax
Date: Tue, 27 Jul 2010 16:47:28 +0200	[thread overview]
Message-ID: <201007271647.31062.vincent.balat@pps.jussieu.fr> (raw)
In-Reply-To: <54129.88.170.165.56.1280236965.squirrel@imap-sop.inria.fr>

> Are you trying to the same thing as HOP [1] ?

No. Our precise goal and solutions are very different from Hop. Obviously we 
share the main general idea (from the beginning 7 years ago -- and also with 
many other projects) which is to write both sides of Web applications with the 
same high level language. But that is not new (we have been doing this for 
years). Raphaël's work is to make easier to mix client and server code in the 
same file and simplify the interaction between the client and server. We 
already have a syntax for this but it is not exactly the one we want (but this 
is only a problem with camlp4).

> What kind of restrictions do you impose on the expressions you can
> transfer from the server to the client (only non-functional values) ? How
> do you ensure them in your program ?
> 
> Are you sure splitting the code into two parts is sufficient ? How will
> you handle branching than you can decide only at runtime, as example ? HOP
> is using a javascrip compiler embedded in a library to compile efficiently
> the right client code at runtime.
> 
> Btw, would be glad to have more details on what you have done and plan to
> do as I am working on similar things (not very actively currently) : I've
> been trying  to make camloo, a caml-light to bigloo compiler, working
> again (current version[2] is quite working - still few things to finish).
> At one point, the goal would be to extand the source language with similar
> constructs than yours  and to compile to HOP ...

You can find Eliom's documentation on http://ocsigen.org . The documentation 
for the development version is not yet written (we will put it online probably 
in september, and release version 2 of Eliom a few months later). If you are 
working on this with Manuel, we will probably meet soon during the next 
meeting of the PWD project and I will explain you our solution in details.

Vincent Balat

> [1] http://hop.inria.fr
> [2] http://www-sop.inria.fr/members/Thomas.Gazagnaire/
> --
> Thomas
> 
> > Hi all,
> > 
> > I'm working on a syntax extension as part of an internship in the
> 
> Ocsigen team. The aim of the syntax extension is to split the code of a
> web
> 
> > application in two separate files: one for the client and one for the
> 
> server. A
> 
> > few transformations are to take place in the process.
> > 
> > Quotations are to be transformed into client code while antiquotations
> 
> can
> 
> > refer
> > to server side values transmitted to the client at runtime.
> > 
> > 
> > In order to avoid any XY problems, here is an abstracted and simplified
> 
> example
> 
> > of the expected behavior:
> > 
> > (* Pre-parsed code: *)
> > let start = <:on< f $y$ >> in
> > let html_node =
> > 
> >  span ~a:[onclick start] "some text" (* a is used for (html) attributes
> 
> *)
> 
> > (* Server side post-parsed code: *)
> > let start _arg1 =
> > 
> >  "call_closure(some_unique_name," ^ mymarshall _arg1 ")"
> > 
> > in
> > let html_node = span ~a:[onclick (start y)] "some text"
> > 
> > (* Client side post-parsed code: *)
> > let _ = register_closure some_unique_name (fun _arg1 -> f _arg1)
> > 
> > 
> > 
> > If the example isn't clear enough I can detail it a little bit more.
> > 
> > 
> > I'm unsure of what is the standard way of doing such a thing in Camlp4.
> 
> What
> 
> > I
> > have in mind is to use the original Ocaml syntax for the quotation
> 
> expander.
> 
> > This would (IIUC) allow me to filter the AST to transform every
> > antiquotation
> > found inside the quotation itself.
> > 
> > I'm not sure this is the ideal way of doing such a thing because of the
> 
> size
> 
> > of
> > the pattern matching in the AST filter. On the other hand, because the
> 
> quotation
> 
> > is supposed to contain valid OCaml code, it seems normal to reuse the
> 
> original
> 
> > parser.
> > 
> > I considered an alternative solution: treating quotations as raw text
> > (with a
> > custom quotation expander) but that would destroy any _loc information
> 
> and
> 
> > make
> > compile time warnings and errors quite difficult to locate.
> > 
> > 
> > Is there a simpler/fitter way of doing that? (Is the Y correct wrt the
> 
> X?)
> 
> > How can one embed the original parser in a quotation expander? (I
> 
> couldn't
> 
> > find
> > a function of type string -> Ast.expr in the Camlp4 doc/mlis, but I'd be
> 
> happy
> 
> > to be pointed to one if it exists. I think it would at least require
> 
> some
> 
> > functor application.)
> > 
> > Does anyone know of any example that resemble what I'm trying to
> 
> achieve?
> 
> > --
> > _______
> > Raphael
> > _______________________________________________
> > Caml-list mailing list. Subscription management:
> > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> > Archives: http://caml.inria.fr
> > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> > Bug reports: http://caml.inria.fr/bin/caml-bugs
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


      parent reply	other threads:[~2010-07-27 14:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTikuoN4H0Hsx74JwW66J9jmtq+usDxtQPpYfSGbd@mail.gmail.com>
2010-07-26 14:41 ` Raphael Proust
2010-07-26 15:13   ` [Caml-list] " Nicolas Pouillard
2010-07-26 15:41     ` Joel Reymont
2010-07-26 16:05       ` Jake Donham
2010-07-26 15:41     ` Raphael Proust
2010-07-26 16:27       ` Nicolas Pouillard
2010-07-26 16:30       ` Jake Donham
2010-07-27  7:57         ` Raphael Proust
2010-07-26 20:08   ` bluestorm
2010-07-26 20:53     ` Raphael Proust
2010-07-27 13:22   ` Thomas.Gazagnaire
2010-07-27 14:38     ` Raphael Proust
2010-07-27 14:47     ` Vincent Balat [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201007271647.31062.vincent.balat@pps.jussieu.fr \
    --to=vincent.balat@pps.jussieu.fr \
    --cc=Thomas.Gazagnaire@sophia.inria.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=raphlalou@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).