Skip to main content

Eliom: A Core ML Language for Tierless Web Programming

  • Conference paper
  • First Online:
Programming Languages and Systems (APLAS 2016)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 10017))

Included in the following conference series:

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Balat, V.: Client-server web applications widgets. In: WWW 2013 Dev Track (2013)

    Google Scholar 

  2. Balat, V.: Rethinking traditional web interaction: theory and implementation. Int. J. Adv. Internet Technol. 63–74 (2014)

    Google Scholar 

  3. Balat, V., Chambart, P., Henry, G.: Client-server web applications with Ocsigen. In: WWW 2012 Dev Track, p. 59. Lyon, France, April 2012

    Google Scholar 

  4. Balat, V., Vouillon, J., Yakobowski, B.: Experience report: Ocsigen, a web programming framework. In: ICFP, pp. 311–316. ACM (2009)

    Google Scholar 

  5. BeSport. http://www.besport.com/

  6. 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)

    Google Scholar 

  7. Chlipala, A.: An optimizing compiler for a purely functional web-application language. In: ICFP (2015)

    Google Scholar 

  8. Chlipala, A.: Ur/Web: a simple model for programming the web. In: POPL (2015)

    Google Scholar 

  9. 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)

    Google Scholar 

  10. 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

    Chapter  Google Scholar 

  11. Ekblad, A., Claessen, K.: A seamless, client-centric programming model for type safe web applications. In: SIGPLAN Symposium on Haskell, Haskell 2014 (2014)

    Google Scholar 

  12. Eliom web site. http://ocsigen.org/

  13. New York University Gencore. http://gencore.bio.nyu.edu/

  14. Kiselyov, O.: The design and implementation of BER MetaOCaml - system description. In: FLOPS (2014)

    Google Scholar 

  15. Meteor.js. http://meteor.com

  16. Ocsigen toolkit. http://ocsigen.org/ocsigen-toolkit/

  17. Opa web site. http://opalang.org/

  18. Philips, L., De Roover, C., Van Cutsem, T., De Meuter, W.: Towards tierless web development without tierless languages. In: Onward! 2014 (2014)

    Google Scholar 

  19. Pumgrana. http://www.pumgrana.com/

  20. 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)

    Google Scholar 

  21. Serrano, M., Queinnec, C.: A multi-tier semantics for Hop. Higher-Order Symbolic Comput. 23(4), 409–431 (2010)

    Article  MATH  Google Scholar 

  22. Tyxml. http://ocsigen.org/tyxml/

  23. Vouillon, J.: Lwt: a cooperative thread library. In: ACM Workshop on ML (2008)

    Google Scholar 

  24. Vouillon, J., Balat, V.: From bytecode to JavaScript: the Js_of_ocaml compiler. Softw. Pract. Experience 44(8), 951–972 (2014)

    Article  Google Scholar 

  25. White, L., Bour, F., Yallop, J.: Modular implicits. In: ML workshop (2014)

    Google Scholar 

  26. Wright, A.K., Felleisen, M.: A syntactic approach to type soundness. Inf. Comput. 115(1), 38–94 (1994)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Gabriel Radanne .

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:

$$ f{\mathtt {\%}}e_s \longrightarrow \mathtt {fragment}{\mathtt {\%}}({\texttt {decode}}\ f)\ \mathtt {serial}{\mathtt {\%}}({\texttt {encode}}\ f\ e_s) $$

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:

$$\begin{aligned} \{\{~C[f{\mathtt {\%}}e_s]~\}\}&\longrightarrow (\lambda x . C[f{\mathtt {\%}}x] )\ e_s\\ {\mathtt {let}}_{c}\ y = C[f{\mathtt {\%}}e_s]\ {\mathtt {in}}\ p&\longrightarrow {\mathtt {let}}_{s}\ x = e_s\ {\mathtt {in}}\ {\mathtt {let}}_{c}\ y = C[f{\mathtt {\%}}x]\ {\mathtt {in}}\ p\\&\qquad \ \text {Where}\, x \, \text {is fresh.} \end{aligned}$$

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

Reprints 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)

Publish with us

Policies and ethics