[m-dev.] pragma proc_rep proposal

Ian MacLarty maclarty at cs.mu.OZ.AU
Wed Jun 28 15:49:03 AEST 2006


Hello,

I'd like to propose a new pragma.  The pragma will take the id of a
procedure as an argument and will cause the compiler to generate a new
function that returns a representation of the body of the procedure.
The representation will look something like the representations
generated by the compiler in the declarative debugging grades, though
they may be a bit more general (I haven't considered the specifics of
the representation in too much detail).

Motivation:

For web based applications (especially those based on the AJAX
architecture, which is becoming very popular) there is a need for much
of the logic of the application to be on the client side.  Typically
this logic must be implemented in javascript, since the only programming
language most web browsers understand is javascript.  Often this logic
can be very complex, making it unsuitable for an untyped scripting
language like javascript.

It would be much nicer if the client side logic could be implemented in
Mercury.  Using the proposed pragma we could then translate the bits we
need to be executed on the client into javascript (or alternatively
implement a javascript interpretter for the Mercury code).
This would be similar to what googles GWT toolkit does, except that it
translates Java to Javascript, not Mercury :-)

I suspect the pragma would also make it easier to implement automatic
coverage test case generators.

There are probably also other benefits to being able to interpret pieces
of Mercury code.

I understand that including type information will be problematic and
that without type information I won't be able to do type reflection or
typeclass dictionary look ups in the interpretter.  I'm prepared to
accept these limitations for now.

The representations must be generated by the compiler.  We cannot just
parse a Mercury source file and get them from there, since we want the
representation after mode reordering and typechecking.

Any comments?

Ian.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list