Abstract
Eliom is a dialect of OCaml for Web programming in which server and client pieces of code can be mixed in the same file using syntactic annotations. This allows to build a whole application as a single distributed program, in which it is possible to define in a composable way reusable widgets with both server and client behaviors. Our language also enables simple and type-safe communication. Eliom matches the specificities of the Web by allowing the programmer to interleave client and server code while maintaining efficient one-way server-to-client communication. The Eliom language is both sufficiently small to be implemented on top of an existing language and sufficiently powerful to allow expressing many idioms of Web programming.
In this paper, we present a formalization of the core language of Eliom. We provide a type system, the execution model and a compilation scheme.
This work was partially performed at IRILL, center for Free Software Research and Innovation in Paris, France, http://www.irill.org.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Balat, V.: Client-server web applications widgets. In: WWW 2013 Dev Track (2013)
Balat, V.: Rethinking traditional web interaction: theory and implementation. Int. J. Adv. Internet Technol. 63–74 (2014)
Balat, V., Chambart, P., Henry, G.: Client-server web applications with Ocsigen. In: WWW 2012 Dev Track, p. 59. Lyon, France, April 2012
Balat, V., Vouillon, J., Yakobowski, B.: Experience report: Ocsigen, a web programming framework. In: ICFP, pp. 311–316. ACM (2009)
BeSport. http://www.besport.com/
Boudol, G., Luo, Z., Rezk, T., Serrano, M.: Reasoning about web applications: an operational semantics for HOP. Trans. Program. Lang. Syst. 34(2), 10 (2012)
Chlipala, A.: An optimizing compiler for a purely functional web-application language. In: ICFP (2015)
Chlipala, A.: Ur/Web: a simple model for programming the web. In: POPL (2015)
Chong, S., Liu, J., Myers, A.C., Qi, X., Vikram, K., Zheng, L., Zheng, X.: Secure web applications via automatic partitioning. In: SOSP 2007 (2007)
Cooper, E., Lindley, S., Wadler, P., Yallop, J.: Links: web programming without tiers. In: Boer, F.S., Bonsangue, M.M., Graf, S., Roever, W.-P. (eds.) FMCO 2006. LNCS, vol. 4709, pp. 266–296. Springer, Heidelberg (2007). doi:10.1007/978-3-540-74792-5_12
Ekblad, A., Claessen, K.: A seamless, client-centric programming model for type safe web applications. In: SIGPLAN Symposium on Haskell, Haskell 2014 (2014)
Eliom web site. http://ocsigen.org/
New York University Gencore. http://gencore.bio.nyu.edu/
Kiselyov, O.: The design and implementation of BER MetaOCaml - system description. In: FLOPS (2014)
Meteor.js. http://meteor.com
Ocsigen toolkit. http://ocsigen.org/ocsigen-toolkit/
Opa web site. http://opalang.org/
Philips, L., De Roover, C., Van Cutsem, T., De Meuter, W.: Towards tierless web development without tierless languages. In: Onward! 2014 (2014)
Pumgrana. http://www.pumgrana.com/
Scherer, G., Vouillon, J.: Macaque : Interrogation sûre et flexible de base de données depuis OCaml. In: 21ème journées francophones des langages applicatifs (2010)
Serrano, M., Queinnec, C.: A multi-tier semantics for Hop. Higher-Order Symbolic Comput. 23(4), 409–431 (2010)
Tyxml. http://ocsigen.org/tyxml/
Vouillon, J.: Lwt: a cooperative thread library. In: ACM Workshop on ML (2008)
Vouillon, J., Balat, V.: From bytecode to JavaScript: the Js_of_ocaml compiler. Softw. Pract. Experience 44(8), 951–972 (2014)
White, L., Bour, F., Yallop, J.: Modular implicits. In: ML workshop (2014)
Wright, A.K., Felleisen, M.: A syntactic approach to type soundness. Inf. Comput. 115(1), 38–94 (1994)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
A Translation from Eliom \(_{\varepsilon }\) to \({\textsc {ML}}_{\varepsilon }\)
A Translation from Eliom \(_{\varepsilon }\) to \({\textsc {ML}}_{\varepsilon }\)
We define two rewriting functions, \(\rho _{s}\) and \(\rho _{c}\), which take as input an \({\textsc {Eliom}}_{\varepsilon }\) program and output respectively an \({\textsc {ML}}_{s}\) and an \({\textsc {ML}}_{c}\) program.
We define some preliminaries notations. Brackets [ and ] are used as meta-syntactic markers for repeated expressions: \([\dots ]_i\) is repeated for all i. The bounds are usually omitted. Lists are denoted with an overline: \(\overline{x_i}\) is the list \([x_0,\dots ,x_{n-1}]\). We allow the use of lists inside substitutions to denote simultaneous independent substitutions. For instance \(e[\overline{v_i}/\overline{x_i}]\) is equivalent to \(e[v_0/x_0]\dots [v_{n-1}/x_{n-1}]\). We will only consider substitutions where the order is irrelevant.
We also consider two new operations:
-
\(injections(e_c)\) returns the list of injections in \(e_c\).
-
\(fragments(e_s)\) returns the list of fragments in \(e_s\).
The order corresponds to the order of execution for our common subset of ML.
As in Sect. 4.3, we assume that fragments are first rewritten in the following manner:
We also assume that expressions inside injections are hoisted out of the local client scope. For example \(\{\{~f{\mathtt {\%}}(3+x)~\}\}\) is transformed to \(\lambda y . \{\{~f{\mathtt {\%}}y~\}\} \ (3+x)\). More formally, we apply the following transformations:
This transformation preserves the semantics, thanks to the validity constraint on programs presented in Sect. 3.1.
We can now define \(\rho _{s}\) and \(\rho _{c}\) by induction over \({\textsc {Eliom}}_{\varepsilon }\)programs. We refer to Sect. 4.3 for a textual explanation.
Since we already translated custom converters, all the converters considered are either \(\mathtt {fragment}\) or \(\mathtt {serial}\). Here is the definition for client sections:
Here is the definition for server sections. Note the presence of lists of lists, to handle injections inside each fragment.
Finally, the returned expression of an \({\textsc {Eliom}}_{\varepsilon }\)program. The translation is similar to client sections:
Rights and permissions
Copyright information
© 2016 Springer International Publishing AG
About this paper
Cite this paper
Radanne, G., Vouillon, J., Balat, V. (2016). Eliom: A Core ML Language for Tierless Web Programming. In: Igarashi, A. (eds) Programming Languages and Systems. APLAS 2016. Lecture Notes in Computer Science(), vol 10017. Springer, Cham. https://doi.org/10.1007/978-3-319-47958-3_20
Download citation
DOI: https://doi.org/10.1007/978-3-319-47958-3_20
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-47957-6
Online ISBN: 978-3-319-47958-3
eBook Packages: Computer ScienceComputer Science (R0)