Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Migrating to new module names

Starting with Eliom 13, Ocsigen Server 8, Ocsigen Toolkit 5, and Ocsigen Start 9, all Ocsigen projects use hierarchical module names:

Old nameNew name
Eliom_serviceEliom.Service
Eliom_contentEliom.Content
Eliom_registrationEliom.Registration
Eliom_parameterEliom.Parameter
Ot_popupOt.Popup
Ot_carouselOt.Carousel
Os_sessionOs.Session
Os_userOs.User
Ocsigen_extensionsOcsigen.Extensions
Ocsigen_configOcsigen.Config
Ocsigen_libOcsigen_base.Lib

Using compatibility packages

To migrate progressively, you can use the compatibility packages. They provide the old module names as aliases to the new ones, so your existing code compiles without changes.

Install the compat packages you need:

opam install eliom-compat ocsigenserver-compat \
  ocsigen-toolkit-compat ocsigen-start-compat

Then add them to the (libraries ...) in your dune file:

; Server library
(libraries
  eliom.server
  eliom-compat.server
  ocsigenserver-compat
  ocsigenserver-compat.baselib
  ocsigen-start.server
  ocsigen-start-compat.server
  ocsigen-toolkit-compat.server
  ...)

; Client executable or library
(libraries
  eliom.client
  eliom-compat.client
  ocsigen-start-compat.client
  ocsigen-toolkit-compat.client
  ...)

Your code will compile as before, using the old module names.

Migrating your code

Once the compat packages are in place, you can migrate your code file by file, replacing old names with new ones. When a file is fully migrated, you can remove the compat libraries it depended on.

The following renaming patterns apply:

  • Eliom: Eliom_xxx becomes Eliom.Xxx (e.g. Eliom_content.Html.FEliom.Content.Html.F)
  • Ocsigen Server: Ocsigen_xxx becomes Ocsigen.Xxx (e.g. Ocsigen_extensions.ConfigurationOcsigen.Extensions.Configuration)
  • Ocsigen Server baselib: Ocsigen_lib becomes Ocsigen_base.Lib, Ocsigen_cache becomes Ocsigen_base.Cache
  • Ocsigen Toolkit: Ot_xxx becomes Ot.Xxx (e.g. Ot_popup.popupOt.Popup.popup)
  • Ocsigen Start: Os_xxx becomes Os.Xxx (e.g. Os_session.connected_funOs.Session.connected_fun)

A few modules keep their old name because of conflicts with other libraries:

  • Eliom.Eliom_react (conflict with react library)
  • Eliom.Eliom_form (conflict with js_of_ocaml)
  • Eliom.Eliom_lazy (conflict with Stdlib.Lazy)
  • Eliom.Eliom_uri (conflict with uri library)

Other changes

  • Eliom.run () has been renamed to Eliom.App.run (). This is an API change, not covered by the compat packages.
  • ocsigen-i18n 5.0 now adds [@@deriving json] automatically in --eliom mode. Remove any sed hack that was adding it manually.