OCaml Weekly News
Hello
Here is the latest OCaml Weekly News, for the week of May 07 to 14, 2024.
Table of Contents
Some code for Molecular Mechanics in OCaml
UnixJunkie announced
Recently, I released a bunch of code for some Molecular Mechanics calculations in OCaml.
This is pretty much at the beta stage for the moment.
https://github.com/UnixJunkie/MMO
Maybe in the future I will create a proper library to encapsulate the Mol and Mol2 modules in there; they allow to perform some operations on small molecules.
For those interested, there is a partial implementation of the Universal Force Field (UFF) in there; only the part concerning non-bonded interactions.
OCaml.org Newsletter: April 2024
Sabine Schmaltz announced
Welcome to the April 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 people who help us review, revise, and create better OCaml documentation and work on issues. Your participation enables us to so much more than we could just by ourselves. Thank you!
This newsletter covers:
- OCaml Cookbook: We shipped a new, community-driven section in the Learn area. Help us make it really useful by contributing and reviewing recipes for common tasks!
- Community & Marketing Pages Rework: We have UI designs for the reworked and new pages of the community section and are starting work to implement these.
- General Improvements: As usual, we also worked on general maintenance and improvements, so we're highlighting some of the work that happened below.
Open Issues for Contributors
You can find open issues for contributors here!
Here's some new (and as of time of writing this newsletter still open) issues that were opened this month:
- Package Versions page is missing dark mode styles ocaml/ocaml.org#2341 by @sabine
- (Data) Extend the Data Model of Academic Institution to Record Information about Course Materials ocaml/ocaml.org#2328 by @sabine
The OCaml Cookbook
We shipped a new, community-driven section in the Learn area: the OCaml Cookbook!
The OCaml Cookbook is a place where OCaml developers share how to solve common tasks using packages from the ecosystem.
A task is something that needs to be done inside a project. A recipe is a code sample and explanations on how to perform a task using a combination of open source libraries.
The Cookbook now live at ocaml.org/cookbook, but there are not a lot of recipes published yet.
Here's how we need your help:
- Help review open pull requests for cookbook recipes!
- Contribute new recipes and tasks for the cookbook!
- Suggest improvements to existing recipes and the UI.
Relevant PRs and Activities:
- Open PRs in need of reviewers:
- PR: Cookbook geodesic ocaml/ocaml.org#2381 by @F-Loyer
- PR: Cookbook / subprocess creation ocaml/ocaml.org#2382 by @F-Loyer
- PR: Cookbook getenv ocaml/ocaml.org#2383 by @F-Loyer
- PR: Cookbook : linalg ocaml/ocaml.org#2386 by @F-Loyer
- PR: Use camlzip and with_open_text ocaml/ocaml.org#2371 by @cuihtlauac
- PR: Deserialise and post-process YAML recipes ocaml/ocaml.org#2372 by @cuihtlauac
- PR: Rebased database recipes ocaml/ocaml.org#2376 by @cuihtlauac
- PR: Rebased basic concurrency recipe ocaml/ocaml.org#2377 by @cuihtlauac
- PR: Rebased sorting recipe ocaml/ocaml.org#2378 by @cuihtlauac
- PR: Rebased ascii and utf-8 recipes ocaml/ocaml.org#2379 by @cuihtlauac
Community & Marketing Pages Rework
We have UI designs for the reworked and new pages of the community section and are starting work to implement these. We are opening small issues for contributors to help. :orange_heart:
Relevant PRs and Activities:
- PR: UI: Added DateTime of Event on the Client Side in the User's Timezone ocaml/ocaml.org#2339 by @maha-sachin
- PR: Create new Events page with routing under Community ocaml/ocaml.org#2338 by @shakthimaan
- PR: Add event_type field to Events, and render tag in Event cards ocaml/ocaml.org#2366 by @csaltachin
General Improvements and Data Additions
Relevant PRs and Activities:
- Bugfixes
- PR: fix: add .modules style for odoc-generated documentation pages ocaml/ocaml.org#2355 by @sabine
- PR: Fix: correct text color on community resource card ocaml/ocaml.org#2329 by @sabine
- PR: fix: Make Community card about LearnOCaml point to the correct URL ocaml/ocaml.org#2331 by @yurug
- Documentation
- PR: OCaml Tour: -New sections- Introduction and Before We Begin. Added REPL definition and double semicolon use ocaml/ocaml.org#2336 by @Alfredo-Carlon
- PR: Minor line editing on "Values and Functions" Tutorial ocaml/ocaml.org#2321 by @jeuxdeau
- Data
- PR: [planet]: add melange blog ocaml/ocaml.org#2362 by @anmonteiro
- PR: (data) add april OUPS meetup ocaml/ocaml.org#2360 by @sabine
- PR: Add TUM as an academic institution ocaml/ocaml.org#2347 by @PumPum7
- PR: Add Routine job post. ocaml/ocaml.org#2325 by @mefyl
- PR: (data) Add OCaml Workshop to Upcoming Events ocaml/ocaml.org#2326 by @sabine
- PR: (data) add ReasonSTHLM meetup ocaml/ocaml.org#2308 by @sabine
- PR: Add missing Mdx changelogs ocaml/ocaml.org#2368 by @tmattio
- PR: Fix small typo in Dune 3.14 announcement ocaml/ocaml.org#2315 by @Leonidas-from-XIV
- PR: Dune 3.15.0 announcement ocaml/ocaml.org#2316 by @Leonidas-from-XIV
- PR: OCaml 5.2.0-beta2 changelog entry ocaml/ocaml.org#2343 by @Octachron
- PR: (data) add March 2024 OCaml.org newsletter ocaml/ocaml.org#2317 by @sabine
- PR: Add the announement for opam 2.2.0~beta2 ocaml/ocaml.org#2334 by @kit-ty-kate
- PR: jobs: remove XenServer positions ocaml/ocaml.org#2387 by @edwintorok
- Move of the OCaml Language Manual from v2.ocaml.org to ocaml.org
- PR: fix: Serve manual under /lts and /latest URLs ocaml/ocaml.org#2345 by @sabine
- PR: Remove /manual/lts URL, fix broken route for /manual/latest ocaml/ocaml.org#2348 by @sabine
- PR: Add /api/** redirection ocaml/ocaml.org#2352 by @mtelvers
- PR: Handle lts, default and missing version in middleware ocaml/ocaml.org#2358 by @cuihtlauac
- PR: Add served pages to sitemap ocaml/ocaml.org#2363 by @cuihtlauac
- PR: Skip unreleased manuals from sitemap ocaml/ocaml.org#2367 by @cuihtlauac
- PR: Turn some v2 redirects into local ocaml/ocaml.org#2356 by @cuihtlauac
- Refactor / Code health
- PR: Remove Commit module from Global ocaml/ocaml.org#2319 by @cuihtlauac (created/merged: 2024-04-05T14:17:31Z)
- PR: chore: remove learn_sidebar.eml, which was not used anymore ocaml/ocaml.org#2342 by @sabine
- PR: Add link to deploy.ci.ocaml.org in HACKING ocaml/ocaml.org#2354 by @cuihtlauac
- PR: Use type annotation for data parameters ocaml/ocaml.org#2384 by @cuihtlauac
Example of using LSP server in Emacs
Tim McGilchrist announced
I wrote a blog post about my setup https://lambdafoo.com/posts/2022-09-07-ocaml-with-emacs-2022.html The only change I've made is to use envrc-mode
rather than direnv-mode
.
Dune Developer Experience Feedback Form
ostera announced
The Dune team at Tarides is looking to get inputs from all of you to improve the Dune DX (developer experience), so we've opened a small, anonymous, unstructured feedback form to hear your ideas on how Dune could be improved :camel:
We're looking forward to your ideas! :sparkles:
DkML 2.1.1
jbeckford announced
Use https://ocaml.org/install if you are a first-time user (the install steps haven't changed).
The upgrade steps and release notes are available at https://gitlab.com/dkml/distributions/dkml/-/releases/2.1.1. For those who are on 2.1.0, the upgrade is the following in PowerShell:
1..6 | % { @("bash","sh","with-dkml","ocamllsp","git","opam","dune","ocamlrun") | % { taskkill /F /IM "$_.exe" }; Start-Sleep 1 } winget upgrade dkml
Major Changes
- The opam repository is fixed to commit 6c3f73f42890cc19f81eb1dec8023c2cd7b8b5cd for stability. If you need a new version of a package and can't wait for the next version of DkML, you can pin that package's url (recommended) or float the opam repository with
opam repository set-url default git+https://github.com/ocaml/opam-repository.git#main
. - Windows SDK 10.0.22621.0 and VC 17.8 (14.38) added to allowed list. This supports Visual Studio 2022, especially for GitLab CI.
- New supported package:
tiny_httpd
Patches
Package | What | Issue |
---|---|---|
base_bigstring.v16.0 | Implement memmem for Windows | https://github.com/janestreet/base_bigstring/issues/6 |
core_kernel.v0.16.0 | MSVC fix didn't make it to 0.16.0 | https://github.com/janestreet/core_kernel/pull/107 |
Upgraded Packages
Package | From | To |
---|---|---|
dune (et al) | 3.12.1 | 3.15.0 |
ocaml | 4.14.0 | 4.14.2 |
ocamlformat (et al) | 0.25.1 | 0.26.1 |
odoc | 2.2.0 | 2.4.1 |
odoc-parser | 2.0.0 | 2.4.1 |
lsp (et al) | 1.16.2 | 1.17.0 |
mdx | 2.3.0 | 2.4.1 |
ctypes (et al) | 0.19.2-windowssupport-r7 | 0.19.2-windowssupport-r8 |
tiny_httpd | 0.16 |
Thanks to OCaml Software Foundation for sponsoring DkML!
A May update on wasm_of_ocaml
Jan Midtgaard announced
Spring is over us and several months have passed since we last shared an update on WebAssembly compilation.
Introduction
wasm_of_ocaml
is a compiler from OCaml bytecode to WebAssembly, similar to js_of_ocaml
from which it was forked. wasm_of_ocaml
offers a functional, almost drop-in replacement for js_of_ocaml
- with better performance.
For now, the compiler targets a JavaScript-hosted WebAssembly engine. The produced code furthermore requires the following Wasm extensions to run:
- the GC extension, including functional references and 31-bit integers
- the tail-call extension
- the exception handling extension
Platform support
- Node 22 now supports the WasmGC extension, meaning that it can run
wasm_of_ocaml
output out of the box! - CloudFlare uses V8 12.0 since Dec 4, 2023. This corresponds to Chrome 120, and thus includes the WasmGC extension, effectively enabling OCaml development on CloudFlare! For more details see the WebAssembly CloudFlare docs
- The upcoming 0.14.0 release of the WasmEdge WebAssembly engine adds WasmGC support too. Along with the just merged exception support, this paves the way for running
wasm_of_ocaml
output…
wasm_of_ocaml
news
Since the last update in December
- Jérôme gave a talk about
wasm_of_ocaml
at the INRIA Cambium seminar - slides available here - Olivier Nicole joined the
wasm_of_ocaml
effort - Jérôme and Olivier visited Jane Street to help them adopt
wasm_of_ocaml
Notable features
- Sourcemap support was added ocaml-wasm/wasm_of_ocaml#27
- This required adding sourcemap support to the
wasm-metadce
andwasm-merge
binaryen tools WebAssembly/binaryen#6372
- This required adding sourcemap support to the
- A first implementation of separate compilation was completed ocaml-wasm/wasm_of_ocaml#36
- One can compile cmo and cma files, producing intermediate archive files
- Then the files can be linked together: relevant Wasm modules are put in a directory, and JavaScript code is generated to load them and link them together
- Store long-lived toplevel values into globals ocaml-wasm/wasm_of_ocaml#30
- The initialization code produced by
wasm_of_ocaml
can be large and contain a large number of variables. This is challenging to both binaryen tools and the Wasm engines. The problem can be alleviated by storing long-lived toplevel values into global variables. As an side benefit, many closures can be statically allocated (since their free variables are now stored in globals), which again can provide performance improvements in the remaining parts of the code.
- The initialization code produced by
- Tuple syntax changes ocaml-wasm/wasm_of_ocaml#31
- Prepared the switch to the new version of binaryen, which has small syntax changes
- Use the JS String Builtins proposal for string conversions when available ocaml-wasm/wasm_of_ocaml#33
- Improve the WAT (Wasm text format) output to be more readable ocaml-wasm/wasm_of_ocaml#34
- Name local variables (they were just numbered) and use shorter names (the names used to be systematically suffixed to ensure they were unique).
Other features and fixes
- Fixed file descriptor management so that it works with large file descriptors ocaml-wasm/wasm_of_ocaml#18
- PR: Update Firefox version information in README (no longer beta) ocaml-wasm/wasm_of_ocaml#19
- PR: Fix pin branch in installation instructions ocaml-wasm/wasm_of_ocaml#20
- PR: Add
Stdlib.String.fold_{left,right}
to build on OCaml < 4.13 ocaml-wasm/wasm_of_ocaml#21 - PR translating stubs of
integers_js_stubs
to Wasm o1-labs/integers_stubs_js#10- Tracked a bug in a test on the repo o1-labs/integers_stubs_js#9
- PR: Generate valid Wasm code ocaml-wasm/wasm_of_ocaml#22
- PR: Avoid using
eval
for statically known strings ocaml-wasm/wasm_of_ocaml#24 - PR: Have physical equality inspect Javascript objects ocaml-wasm/wasm_of_ocaml#25
- PR: Tune optimization profiles ocaml-wasm/wasm_of_ocaml#26
- PR: Correction and precision about Binaryen version ocaml-wasm/wasm_of_ocaml#29
Binaryen fixes
- PR: wasm-merge: check that the types of imports and exports match. WebAssembly/binaryen#6437
- Improved binaryen's linker to check that the types of imports and exports match. Found a type mismatch in the wasm_of_ocaml runtime this way.
- PR: Fixes regarding explicit names WebAssembly/binaryen#6466
- The name of some module components were lost during module linking
- PR: Fix writing of data segment names in name section WebAssembly/binaryen#6462
- Binaryen could actually generate a malformed name section
OCaml 5.2.0 released
octachron announced
The OCaml team has the pleasure of celebrating the birthday of Inge Lehmann by announcing the release of OCaml version 5.2.0.
Some of the highlights in OCaml 5.2.0 are:
- Re-introduced GC compaction
GC compaction can now be manually triggered by callingGc.compact ()
manually. This is expected to be particularly useful for programs that wish to release memory to the operating system after a temporary memory-intensive phase. - Restored native backend for POWER 64 bits
With this restored backend, all 64 bits architecture supported in OCaml 4 are supported bin OCaml 5 - Thread sanitizer support
Thread sanitizer is a dynamic data race detector which instrument memory accesses to detect and explain data races at execution time. Since the instrumentation is costly (with a 2x to 7x slowdown), it must be enabled with theocaml-option-tsan
configuration flag. (The reference manual contains more information on how to use TSAN.) - New Dynarray module
This new standard library module provides a standard implementation for resizeable array, which is guaranteed to be memory safe even in presence of data races. - New -H flag for hidden include directories
This new flag makes it possible for build tools to split cleanly dependencies between direct (the dependencies explicitly added by the project) and indirect dependencies (the dependencies introduced by the direct dependencies) without the quirks of previous implementations. - Project-wide occurence metadata support for developer tools
When compiling a module with the-bin-annot
and-bin-annot-occurrences
flags, the compiler stores in the.cmt
file an index of all occurences of values, types, modules, … - Raw identifiers
To improve OCaml upward-compatibility, there is a new syntax for lowercase identifiers,let \#if = 0
, which works even if the identifier is a keyword in some OCaml versions. This change has been adopted in OCaml 5.2 in preparation of the introduction of theeffect
keyword in OCaml 5.3 - Local open in type expressions
Local open are now allowed in type expression:val (+): Int64.(t -> t -> t)
.
And a lot of incremental changes:
- Around 20 new functions in the standard library besides the new Dynarray module (in the
Array
,Float
,Format
,Fun
,In_channel
,Out_channel
, andRandom
modules ) - Many fixes and improvements in the runtime
- Many bug fixes
OCaml 5.2.0 is still a somewhat experimental release compared to the OCaml 4.14 branch. In particular
- The Windows MSVC port is still unavailable.
- Ephemeron performances need to be investigated.
statmemprof
is being tested in the developer branch of OCaml.- There are a number of known runtime concurrency or GC performance bugs (that trigger under rare circumstances).
Since the Windows MSVC port and statmemprof are still missing, the maintenance support for OCaml 4.14 will be extended until at least the end of the year.
Please report any unexpected behaviours on the OCaml issue tracker and post any questions or comments you might have here on discuss.
The full list of changes can be found in the changelog below.
Installation Instructions
The base compiler can be installed as an opam switch with the following commands:
opam update opam switch create 5.2.0
The source code for the release candidate is also directly 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.5.1.0+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 5.2.0+flambda+nffa ocaml-variants.5.2.0+options ocaml-option-flambda ocaml-option-no-flat-float-array
OCaml 5.2.0 Changelog (13 May 2024)
(Changelog elided to reduce message size. Please follow the archive link above for the full message.)
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.
No comments:
Post a Comment