OCaml Weekly News

Previous Week Up Next Week

Hello

Here is the latest OCaml Weekly News, for the week of July 09 to 16, 2024.

Table of Contents

OCaml FFI Sharp Edges and How to Avoid Them

Matt Walker announced

Wrote another blog post about my adventures in Godotcaml. Check it out if you're interested in some details of memory management with a Ctypes FFI. Would love to hear input to some of the questions asked in the post, too, if you'd like!

https://fizzixnerd.com/blog/2024-07-09-ocaml-ffi-sharp-edges-and-how-to-avoid-them/

Ortac 0.3.0 Dynamic formal verification made easy

Nicolas Osborne announced

I'm very pleased to announce this exciting new release of Ortac packages!

Ortac is a set of tools for dynamic verification of Gospel formal specifications of OCaml code.

You can find the project on this repo and install the released packages via opam.

Released packages are:

  • ortac-core
  • ortac-runtime
  • ortac-runtime-qcheck-stm
  • ortac-qcheck-stm
  • ortac-dune

But running: $ opam install ortac-qcheck-stm ortac-dune should be enough to install what is necessary.

Apart from some fixes, this release brings three main improvements to the Ortac/QCheck-STM mode.

The first one is about user experience. This is a two-parts improvement as we:

  1. move to a module-based configuration to reduce the number of arguments to give ortac qcheck-stm while increasing the flexibility of configuration (see documentation for more information)
  2. release the Ortac/Dune plugin which generates the dune rules necessary to generate and run the tests (see README for usage).

With these two improvements, we believe that you have a very good excuse for not writing tests: it is very easy to generate them!

The second improvement is related to the supported subset of Gospel, mainly about how you can express the logical model for your OCaml types: you don't have to limit yourself anymore to the Gospel standard library.

Finally, some work has been put on extending the coverage of the generated tests: functions without any SUT argument and functions mentioning tuples are now included in the tested values.

Happy testing!

dream-html and pure-html 3.5.2

Yawar Amin announced

[ANN] dream-html & pure-html 3.6.0

Hello, I am happy to announce the following changes:

  • Added some htmx attributes that had been omitted. Now as far as I can tell we have complete coverage of all core attributes, additional attributes, and those used by core extensions.
  • Add a ?header:bool optional parameter to to_xml and pp_xml functions to conveniently render the XML header as part of the output.

The OCaml community is signed up for Outreachy!

Siddhi Agrawal announced

I am Siddhi, an Outreachy Summer 2024 intern with the OCaml community. I am working on the ocaml-api-watch project which is a tool that detects changes in the public API of a library and displays them in a human readable, git diff-like format so that the users and maintainers can stay on top of them. I am being mentored by @shonfeder, @NathanReb and Odinaka Joy (I am only able to mention people here) and it has been a great experience so far.

I have linked my blogs here if you would like to know more about the project.

OCaml LSP 1.18.0

PizieDust announced

We are happy to announce the release of ocaml-lsp 1.18.0 !

New Features:

This release brings exciting new features such as improved hover behavior with less noisy hovers on some Parsetree nodes such as keywords, comments etc. along with support for hovering over PPX annotations and preview the generated code. This release also have support for some additional custom queries, folding ifthenelse expressions, a new configuration option to control dune diagnostics, improved document symbols, and fixes to a handful of issues.

Do not hesitate to report any suspicious behavior in the issue tracker

2nd editor tooling dev-meeting: 25th of July 🧙

vds announced

After the success of our first public dev-meeting, we are organizing the next one on the 25th of July at 5pm CEST. Whether you are a long time maintainer, an occasional contributor, a new comer, or simply a curious passer-by, please feel free to attend!

✨ We have two talks scheduled for this session:

  • @octachron will present his work on having structured compiler output
  • @nojb will present "typed grep" an tool used at LexiFi to search by type in the codebase.

📋 Meeting agenda:

  • A tour-de-table to allow the participants that wish to do so to present themselves and mention issues / prs they are interested in.
  • Talks and Q&A
  • Discuss issues and pull requests that were tagged in advance or mentioned during the tour-de-table.
  • Discuss possible alternative meeting hours.

We're looking forward to meeting you!

A (Possibly) Safer Interface to the Ctypes FFI

Matt Walker announced

Hi there, another blog post.

This time I discuss ideas for a new interface that helps localize the possibilities of errors when working with a Ctypes-style FFI. Comment below if you like/hate it please!

https://fizzixnerd.com/blog/2024-07-11-a-possibly-safer-interface-to-the-ctypes-ffi/

OCaml Workshop 2024 at ICFP – announcement and call for proposals

Sonja Heinze announced

The accepted talks are now public! You can find them on the Workshop website.

We're very happy with the expected quality and diversity of talks. To give a bit of a taste via a few examples of talks that will be presented:

  • In the context of the OCaml language, On the design and implementation of Modular Explicits will present a major and long-wanted new language feature whose PR on the compiler landed last week.
  • In the context of the OCaml ecosystem, Opam 2.2 and beyond will present technical details as well as struggles about the just-landed 2.2 release of your package manager.
  • In the context of day-to-day OCaml applications, B · o · B, a universal & secure file-transfer software in OCaml will present a real-life MirageOs application.
  • In the context of OCaml developer experience, Project-wide occurrences for OCaml, a progress report will present a shiny new editor feature that makes OCaml code navigation a joy.
  • There will also be four talks in the landscapes of OCaml multi-core (i.e. OCaml 5).

We've given the authors a few weeks to update their abstracts and papers if they want to. At the beginning of August, the scheduled program with updated abstracts and attached papers will be on the website.

For those who haven't seen it yet: The registration for the workshops and the whole conference is open now. There's currently an early bird discount, which ends on August 3rd.

As we've mentioned already, the in-person experience of the workshop is a very nice one, allowing everyone to interact with colleagues and the rest of the community, to chat about the talks and OCaml in general, hit up the speakers etc. However, if you're not able to make it, you'll still be able to enjoy the talks: The talks will be live-streamed, and some time later be made permanently available online.

Really, genuinely, thanks a lot to all members of the Program Committee for the very valuable reviews and interactions as well as to all the authors of all submissions!

living 0.1.0

Matt Walker announced

I'm pleased to announce the first pre-opam version of the living library, currently available only on GitHub for testing. I have some basic tests and a README explaining what it's for, but basically, it prevents mistakes like

open Ctypes

(** Returns a pointer into the argument character string that points to the first
    instance of the argument character. *)
let strchr : char ptr -> char -> char ptr = 
  Foreign.foreign "strchr" (ptr char @-> char @-> returning (ptr char))

let () =
  let p = CArray.start (CArray.of_string "abc") in
  let q = strchr p 'a' in
  let () = Gc.compact () in
  let c = !@ q in
  if Char.(equal c 'a') then print_endline "yay!" else print_endline "boo!"

above from causing you pain. If you weren't aware, the code above will almost always print "boo!". Using `living`, you can replace it with this code:

open Living
open Living_ctypes

let strchr  : char ptr -> char -> char ptr Living_core.t = 
  let strchr_unsafe = Foreign.foreign "strchr" (ptr char @-> char @-> returning (ptr char)) in
  fun s c -> Living_core.(strchr_unsafe s c => s)

let _ =
  let open Living_core.Let_syntax in
  let* p = CArray.start (CArray.of_string "abc") in
  let* q = strchr p 'a' in
  let () = Gc.compact () in
  let* c = !@ q in
  if Char.(equal c 'a') then print_endline "yay!" else print_endline "boo!"
  Living_core.return ()

and it will always print "yay!"

Edit: should probably link to it!

https://github.com/Fizzixnerd/ocaml-living

Other OCaml News

From the ocaml.org blog

Here are links from many OCaml blogs aggregated at 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.