OCaml Weekly News

Previous Week Up Next Week

Hello

Here is the latest OCaml Weekly News, for the week of March 05 to 12, 2024.

Table of Contents

Js_of_ocaml 5.7

Hhugo announced

Js_of_ocaml 5.7.1 has been released today.

It fixes a mis-compilation bug introduced in the last release.

As always, see the Changelog for other changes.

Bindings to QuickJS

David Sancho announced

I’m happy to announce a new library (quickjs.ml) that I have been working on, sometimes on-stream with the help of a few people (specially @welltypedbitch) and other times, just coding lonely.

It’s an early project to bind to quickjs https://bellard.org/quickjs a small and embeddable JavaScript engine. It supports the ES2023 specification including modules, asynchronous generators, proxies and BigInt.

It passes nearly 100% of the ECMAScript Test Suite tests when selecting the ES2023 features. A summary is available at Test262 Report and has very low startup time (compared to other JS Engines).

The need to bind to a JavaScript engine on OCaml appeared while working with server-reason-react components. While moving ReasonReact components from the browser into the server.

Those components relied on JavaScript APIs such as DOM APIs, but also some “pure” JS. The part of the browser isn’t available on the server (obv) so we discard it with a ppx (called browser_ppx https://twitter.com/davesnx/status/1765059888550686892) but still there were some (”pure JS”) code that could run on the server such as Array/List/String operations, RegExp, i18n, Date, etc.

On the browser, those apis are available under melange.js (which are bindings to JS: https://melange.re/v2.0.0/communicate-with-javascript) and I made an effort of having similar implemenations on server-reason-react.js which implemented in OCaml the same APIs, but there were a few issues that I couldn’t resolve in OCaml (or I didn’t want to resolve), for example the JavaScript RegExp engine had backtracing and named groups which Pcre (the first approach I used) doesn’t have.

Those APIs are available (with a full test suite) on many JS engines, so It was a matter of choosing one and bind to it… which brings to release quickjs.ml into opam with RegExp support and ongoing BigInt, Date, parse numbers, and encode/decode URI.

Let me know if you find it useful, and feel free to collab!

PS: I'm very aware that the meme writes itself, OCaml to JS and now we bring JS into OCaml.

Ocaml-windows 5.1.1

Romain Beauxis announced

A little over a week ago, ocaml-windows.5.1.1 was added to ocaml-cross/opam-cross-windows 🎊

The opam-cross-windows repository provides opam packages that build libraries and binaries targetting the windows platform from linux and macos hosts using the mingw-w64 cross-compiler and mxe.cc for extenal dependencies.

The addition of a ocaml cross-compiler version 5.1.1 makes it possible to compile code using the awesome new set of feature of the ocaml 5.x releases!

A lot of packages still need to be updated to support the ocaml 5 compiler. Fortunately, adding new dune-based packages has become remarkably easy thanks to dune's great cross-compilation support. Also, the CI could use some love.

If you find it useful, feel free to come help!

First release candidate for OCaml 4.14.2

octachron announced

The release of OCaml version 4.14.2 is imminent.

OCaml 4.14.2 is a new update to the stable 4.14 branch of OCaml. This new release backports many safe bug fixes from the OCaml 5 branch and fixes a handful of compatibility issues of OCaml 4.14.1 with newer operating system versions.

A full list of bug fixes is available below.

In order to ensure that the future release works as expected, we are planning to test a release candidate during the upcoming week (the rc candidate might take some time to propagate on the opam repository).

If you find any bugs, please report them here on GitHub.

Installation Instructions

The base compiler can be installed as an opam switch with the following commands on opam 2.1:

opam update
opam switch create 4.14.2~rc1

The source code for the release candidate is available on

  • Fine-Tuned Compiler Configuration

    If you want to tweak the configuration of the compiler, you can switch to the option variant with:

    opam update
    opam switch create <switch_name> ocaml-variants.4.14.2~rc1+options <option_list>
    

    where <option_list> is a space-separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

    opam switch create 4.14.2~rc1+flambda+nffa ocaml-variants.4.14.2~rc1+options ocaml-option-flambda ocaml-option-no-flat-float-array
    

    All available options can be listed with opam search ocaml-option.

Changes Since OCaml 4.14.1

  • Runtime System:
    • #11764, #12577: Add prototypes to old-style C function definitions and declarations. (Antonin Décimo, review by Xavier Leroy and Nick Barnes)
    • #11763, #11759, #11861, #12509, #12577: Use strict prototypes on primitives. (Antonin Décimo, review by Xavier Leroy, David Allsopp, Sébastien Hinderer and Nick Barnes)
    • (breaking change) #10723: Do not use -flat-namespace linking for macOS. (Carlo Cabrera, review by Damien Doligez)
    • #11332, #12702: Make sure Bool_val(v) has type bool in C++ (Xavier Leroy, report by ygrek, review by Gabriel Scherer)
  • Build System:
    • #11590: Allow installing to a destination path containing spaces (Élie Brami, review by Sébastien Hinderer and David Allsopp)
    • #12372: Pass option -no-execute-only to the linker for OpenBSD >= 7.3 so that code sections remain readable, as needed for closure marshaling. (Xavier Leroy and Anil Madhavapeddy, review by Anil Madhavapeddy and Sébastien Hinderer)
    • #12903: Disable control flow integrity on OpenBSD >= 7.4 to avoid illegal instruction errors on certain CPUs. (Michael Hendricks, review by Miod Vallat)
  • Bug fixes:
    • #12061, #12063: Don't add inconsistent equalities when computing high-level error messages for functor applications and inclusions. (Florian Angeletti, review by Gabriel Scherer)
    • #12878: Fix incorrect treatment of injectivity for private recursive types. (Jeremy Yallop, review by Gabriel Scherer and Jacques Garrigue)
    • #12971, #12974: Fix an uncaught Ctype. Escape exception on some invalid programs forming recursive types. (Gabriel Scherer, review by Florian Angeletti, report by Neven Villani)
    • #12264, #12289: Fix compact_allocate to avoid a pathological case that causes very slow compaction. (Damien Doligez, report by Arseniy Alekseyev, review by Sadiq Jaffer)
    • #12513, #12518: Automatically enable emulated fma for Visual Studio 2019+ to allow configuration with either pre-Haswell/pre-Piledriver CPUs or running in VirtualBox. Restores parity with the other Windows ports, which don't require explicit --enable-imprecise-c99-float-ops. (David Allsopp, report by Jonah Beckford and Kate Deplaix, review by Sébastien Hinderer)
    • #11633, #11636: Bug fix in caml_unregister_frametable (Frédéric Recoules, review by Gabriel Scherer)
    • #12636, #12646: More prudent reinitialisation of I/O mutexes after a fork() (Xavier Leroy, report by Zach Baylin, review by Enguerrand Decorne)
    • (breaking change) #10845 Emit frametable size on AMD64 BSD (OpenBSD, FreeBSD, NetBSD) systems (emitted for Linux in #8805) (Hannes Mehnert, review by Nicolás Ojeda Bär)
    • #12958: Fix tail-modulo-cons compilation of try-with, &&, and || expressions. (Gabriel Scherer and Nicolás Ojeda Bär, report by Sylvain Boilard, review by Gabriel Scherer)

OCaml.org Newsletter: February 2024

Sabine Schmaltz announced

Welcome to the February 2024 edition of the OCaml.org newsletter! This update has been compiled by the OCaml.org team. You can find previous updates on Discuss.

Our goal is to make OCaml.org the best resource for anyone who wants to get started and be productive in OCaml. The OCaml.org newsletter provides an update on our progress towards that goal and an overview of the changes we are working on.

We couldn't do it without all the amazing OCaml community members who help us review, revise, and create better OCaml documentation. Your feedback enables us to better prioritise our work. Thank you!

This newsletter covers:

  • OCaml Documentation: New documentation has been released, and existing documentation has been improved.
  • OCaml Cookbook: A prototype of an OCaml cookbook that provides short code examples that solve practical problems using packages from the OCaml ecosystem is on staging.ocaml.org/cookbook.
  • Dark Mode: We're almost ready to release dark mode now.
  • Community Section Rework: We are preparing wireframes for the community section to better present the existing content. In addition, we started preliminary work towards a dedicated "Events" page.
  • General Improvements: As usual, we also worked on general maintenance and improvements based on user feedback, so we're highlighting some of our work below.

Open Issues for Contributors & Outreachy Application Period

There are open issues for external contributors. However, since github.com/ocaml/ocaml.org participates in the Outreachy application period, we might have a shortage of open issues in March, since Outreachy applicants will quickly take them on.

You can find open issues for contributors here!

OCaml Documentation

User Testing

Twenty-one brave newbies accepted being observed for one hour while discovering OCaml through the online docs and completing a couple of programming tasks. Many thanks to all the participants of the user testing sessions we held!

Half of the user testing participants used the recently updated tutorials, the other half used v2.ocaml.org/docs. Our takeaway from this is:

  • Learning OCaml isn't hard. However, learning functional programming is. Most participants who had previous FP experience successfully completed the tasks.
  • The updated docs do a little better than the manual at teaching both OCaml and FP to participants without FP experience. A few of them succeeded at the more complex tasks using the new tutorials, while all participants without FP experience failed using the old documentation.

By observing the participants try to make sense of the tasks and find relevant materials in the documentation, we have identified many smaller changes that are likely to improve the user experience on the documentation pages.

Relevant PRs and Activities:

Upcoming OCaml Cookbook

We made some progress towards adding a new, community-driven section to the Learn area: the OCaml Cookbook. The cookbook aims to be a compilation of recipes that provide code samples that solve practical-minded tasks using packages from the OCaml ecosystem.

Here is the design we are considering:

  • Category: High-level groups of tasks, e.g., networking, data compression, or command line arguments.
  • Task: Single thing to be done in a category, e.g., write to a file, make an HTTP GET request, or return an exit status.
  • Recipe: Version of task using a package, e.g., HTTP GET using curly or cohttp.

A rough prototype is on staging.ocaml.org/cookbook. The contributions and the user feedback we received suggest that the structure of the cookbook needs to be refined one more time until it is ready to be released.

A good place to give feedback on the cookbook is this discuss thread.

Relevant PRs and Activities:

Dark Mode

In December, oyenuga17 started to implement the new dark mode on OCaml.org.

By now, the new dark mode is mostly complete, but it hasn't been reviewed or tested sufficiently.

We have enabled the dark mode on staging.ocaml.org, based on your browser / operating system preferences. If you want to help, you can view the dark mode on staging.ocaml.org and report anything you see by opening an issue.

Completed Pages:

Community Section Rework

This month, we have started to do user research on the community area and gathered feedback and ideas on the current pages. Among others, we have identified these:

  • the Community section needs a better Events directory
  • the Jobs page needs to be more easily reachable from the community page
  • it would be great to highlight Open Source projects from the OCaml ecosystem that are looking for contributors

If you have opinions on the community section, feel free to share them in this discuss thread!

Relevant PRs and Activities:

General Improvements

Many thanks go out to the many contributors who helped improve OCaml.org in February. Find them listed below!

Relevant PRs and Activities:

Announcing the New Dark Mode on OCaml.org

Sabine Schmaltz announced

I am happy to announce the launch of the new Dark Mode feature on ocaml.org.

This enhancement was led by UX/UI designer @Claire_Vandenberghe, focusing on an intuitive and eye-friendly design suitable for extended use. The implementation of this feature was carried out by Outreachy intern @Seun, spanning from December to March. We are very happy with her work.

This update aims to provide a more comfortable browsing experience, especially for those who prefer a darker interface for reading documentation.

We invite you to explore the new dark mode and report any issues and possible improvements here! :sparkles::heart:

Call for presentations – ML 2024: ACM SIGPLAN ML Family Workshop

Guillaume Munch-Maccagnoni announced

We are happy to invite submissions to the ML 2024 workshop:

Higher-order, Typed, Inferred, Strict: ACM SIGPLAN ML Family Workshop

Co-located with ICFP

Date
Friday, September 6, 2024
Location
Milan, Italy

Call for presentations

ML (originally, “Meta Language”) is a family of programming languages that includes dialects known as Standard ML, OCaml, and F#, among others. The development of these languages has inspired a large amount of computer science research, both practical and theoretical.

The ML Family Workshop is an established informal workshop aiming to recognize the entire extended ML family and to provide the forum to present and discuss common issues: all aspects of the design, semantics, theory, application, implementation, and teaching of the members of the ML family. We also encourage presentations from related languages (such as Haskell, Scala, Rust, Nemerle, Links, Koka, F*, Eff, ATS, etc), to promote the exchange of ideas and experience. The ML family workshop will be held in close coordination with the OCaml Users and Developers Workshop.

We plan the workshop to an be in-person event with remote participation (streamed live). Speakers are generally expected to present in person (we will work to make remote presentations possible).

  • Deadline for talk proposals: Thursday, June 6, 2024 (AoE)
  • Notification of acceptance: Saturday, July 6, 2024
  • Workshop: Friday, September 6, 2024

Format

The ML 2024 workshop will continue the informal approach followed since 2010. Presentations are selected by the program committee from submitted proposals. There are no published proceedings, so contributions may be submitted for publication elsewhere. The main criterion is the promoting and informing the development of the entire extended ML family and delivering a lively workshop atmosphere. We particularly encourage talks about works in progress, presentations of negative results (things that were expected to but did not quite work out) and informed positions.

We seek presentations on topics including (but not limited to): language design, implementation, type systems, applications, environments, semantics. We specifically encourage reporting what did not meet expectations or what, despite all efforts, did not work to satisfaction. Four kinds of submissions are solicited: Research Presentations, Experience Reports, Demos, and Informed Positions.

The point of the submission should be clear from its first two pages (PC members are not obligated to read any further.)

See the full call for presentations for scope and submission instructions.

dream-html 3.0.0

Yawar Amin announced

[ANN] dream-html 3.2.0

Thanks to Marco Schneider for noticing and adding a missing convenience wrapper for Dream.send, now we have Dream_html.send to write markup directly to a WebSocket as text.

Also a change to use our internal function to escape the text inside HTML comments ie comment "xyz".

ppx_minidebug 1.3.0: toward a logging framework

Lukasz Stafiniak announced

Happy to say ppx_minidebug 1.4.0 is now in the opam repository. The two new features since 1.3.0 are:

  • a Table of Contents view on logs, a log file with selected log entry headers as hyperlinks pointing to anchors in the regular log file(s), the table of contents logs preserve the log tree hierarchy but don't use folding,
  • time stamps optionally output as time elapsed since the start of a program rather than as wall-clock times.

What future development of ppx_minidebug would you like to see?

[poll type=regular results=always public=true chartType=bar]

  • I want flame graphs
  • I want better support for exceptions
  • I want %log_entry (release 1.5.0 already)
  • ppx_minidebug is already good enough for me
  • ppx_minidebug is not for me anyway

[/poll]

Thank You!

Other OCaml News

From the ocaml.org blog

Old CWN

If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.

If you also wish to receive it every week by mail, you may subscribe to the caml-list.