One file, part on server, part on client

In the above clojure code, there is one function, defined in such a way that part of the code runs server side and parts of the code runs client side.

Using jsoo, and the oscigen library, is it possible to do the above with OCaml ? The goal here is to have the “network plumbing” be taken care of by the compiler.

Yes, check this page: All Ocsigen in one page

The section: ‘Eliom: client-server apps’

Eliom can transform OCaml into a multi-tier language, allowing one to implement (both the server and client parts of) a distributed application entirely in OCaml, as a single program. This greatly simplifies communication between server and client.

1 Like
  1. This looks amazing.

  2. Is there any 1000-2000 LOC impl of the core ideas behind let%client,shared,server ? I’m really curious how this is done behind the scenes.

I don’t know of anything like that, but there are several papers explaining and showing examples of the ideas: Research papers (descending order of newest to oldest)