| From: |
| Alan Schmitt <alan.schmitt-AT-polytechnique.org> |
| To: |
| "lwn" <lwn-AT-lwn.net>, "cwn" <cwn-AT-lists.idyll.org>, caml-list-AT-inria.fr |
| Subject: |
| Attn: Development Editor, Latest OCaml Weekly News |
| Date: |
| Tue, 03 Oct 2023 15:00:33 +0200 |
| Message-ID: |
| <m2ttr7yi6m.fsf@mac-03220211.irisa.fr> |
Hello
Here is the latest OCaml Weekly News, for the week of September 26 to
October 03, 2023.
Table of Contents
─────────────────
An update from the ocaml-wasm organization
Interesting OCaml Articles
Batteries v3.7.1
uri.4.4.0
Outreachy December 2023
queenshead: a British pub name generator
OCaml behind the scenes: Exception
A memory-polymorphic, polyglot implementation of SplDoublyLinkedList (as transpiled by Pholyglot
0.2-betachicken)
Packages for making proof assistants
Old CWN
An update from the ocaml-wasm organization
══════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/an-update-from-the-ocaml-wasm...>
Jan Midtgaard announced
───────────────────────
Summer and ICFP has passed since [we announced the `ocaml-wasm'
organization in July]. Here we provide an update from the `wasocaml'
and `wasm_of_ocaml' compiler projects since then.
[we announced the `ocaml-wasm' organization in July]
<https://discuss.ocaml.org/t/announcing-the-ocaml-wasm-org...>
Introduction
╌╌╌╌╌╌╌╌╌╌╌╌
[WebAssembly (Wasm)] is an attractive compilation target for OCaml, as
it holds promises of better web-performance than compiling to
JavaScript and furthermore opens up for running OCaml on new
platforms. [The `ocaml-wasm' organization] is a joint effort between
two Wasm-targeting compiler projects for OCaml:
• [`wasocaml'] - an FLambda-based backend for OCaml’s native code
compiler
• [`wasm_of_ocaml'] - a fork of [`js_of_ocaml'] that consumes OCaml
bytecode and emits Wasm instead of JavaScript
Both compilers depend on [the proposed garbage collection (GC)
extension to Wasm], which is available behind a flag in development
versions of Chrome, Firefox, and Node.js. As a first news item, we are
excited to share that [the Wasm GC proposal has moved to stage 4]. As
a consequence [Chrome is planning to enable the WasmGC extension in
version 119], [scheduled to release in November!] :tada:
[WebAssembly (Wasm)] <https://webassembly.org/>
[The `ocaml-wasm' organization] <https://github.com/ocaml-wasm>
[`wasocaml'] <https://github.com/OCamlPro/wasocaml>
[`wasm_of_ocaml'] <https://github.com/ocaml-wasm/wasm_of_ocaml>
[`js_of_ocaml'] <https://github.com/ocsigen/js_of_ocaml>
[the proposed garbage collection (GC) extension to Wasm]
<https://github.com/WebAssembly/gc>
[the Wasm GC proposal has moved to stage 4]
<https://github.com/WebAssembly/proposals/pull/172>
[Chrome is planning to enable the WasmGC extension in version 119]
<https://groups.google.com/a/chromium.org/g/blink-dev/c/K_...>
[scheduled to release in November!] <https://chromestatus.com/roadmap>
`wasocaml'
╌╌╌╌╌╌╌╌╌╌
• @chambart presented `wasocaml' at the [ML workshop in Seattle] in
early September in connection with ICFP’23
• Here’s [a video link to the recorded presentation]
• The [slides and the workshop paper are available from this page]
with more details about the compiler
• After having benchmarked `wasocaml', it was noticed that V8
exceptions are too slow right now. The OCaml exception compilation
strategy has been changed to avoid using the native Wasm ones for
now. This will be turned back into proper Wasm exceptions when the
engines improve.
[ML workshop in Seattle]
<https://icfp23.sigplan.org/home/mlworkshop-2023#program>
[a video link to the recorded presentation]
<https://youtu.be/M5M3f31pxns?list=PLyrlk8Xaylp7Ea-Zu98G_V...>
[slides and the workshop paper are available from this page]
<https://icfp23.sigplan.org/details/ocaml-2023-papers/13/W...>
`wasm_of_ocaml'
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
@vouillon has made solid progress on implementing run-time bindings,
which means that `wasm_of_ocaml' can now
• compile `ocamlc' itself into Wasm
• run the [Bonsai tests and examples]
Early benchmarks results are encouraging: Compiled programs typically
run around 10-20% faster compared to the `js_of_ocaml' equivalent.
A more detailed status:
• Lots of runtime bindings have been implemented
• for even more parts of the OCaml `Stdlib': bigarrays, weak
pointers, ephemerons, marshaling/unmarshaling
• for external packages: `base', `core', `ppx_expect',
`ppx_inline_test', `time_now', `incr_dom', `alcotest',
`base_bigstring', `core_kernel', `string_dict', `bigstringaf',
`js_of_ocaml_patches', `ocaml-cstruct', `Zarith'
• A number of PRs to get `Wasm_of_ocaml' supported:
• in `dune' [ocaml/dune#8278]
• in `gen_js_api' [LexiFi/gen_js_api#173]
• in `Brr' [dbuenzli/brr#51] and
• to improve the `js_of_ocaml'-`wasm_of_ocaml' compatibility
[ocsigen/js_of_ocaml#1492]
• It is now possible to include JavaScript runtime files and to use
JavaScript primitives from Wasm runtime code, reusing the
`js_of_ocaml' linker.
• [Implemented Effect support through CPS transformation] for
comparison with the current JS promise integration implementation
• Updates contributing to the on-going Wasm GC ecosystem development:
• Make the legacy parser follow more closely the standard GC text
format [WebAssembly/binaryen#5889]
• Update stringref text format [WebAssembly/binaryen#5891]
• Use the standard syntax for ref.cast, ref.test and array.new_fixed
[WebAssembly/binaryen#5894]
• Fixed a V8 crash
<https://chromium-review.googlesource.com/c/v8/v8/+/4660286> and
implemented a workaround in binaryen tools
[WebAssembly/binaryen#5799]
• Fixed the binaryen linker `wasm-merge' to support exporting an
imported module entry [WebAssembly/binaryen#5813]
[Bonsai tests and examples] <https://github.com/janestreet/bonsai>
[ocaml/dune#8278] <https://github.com/ocaml/dune/pull/8278>
[LexiFi/gen_js_api#173] <https://github.com/LexiFi/gen_js_api/pull/173>
[dbuenzli/brr#51] <https://github.com/dbuenzli/brr/pull/51>
[ocsigen/js_of_ocaml#1492]
<https://github.com/ocsigen/js_of_ocaml/pull/1492>
[Implemented Effect support through CPS transformation]
<https://github.com/ocaml-wasm/wasm_of_ocaml/commit/e731e4...>
[WebAssembly/binaryen#5889]
<https://github.com/WebAssembly/binaryen/pull/5889>
[WebAssembly/binaryen#5891]
<https://github.com/WebAssembly/binaryen/pull/5891>
[WebAssembly/binaryen#5894]
<https://github.com/WebAssembly/binaryen/pull/5894>
[WebAssembly/binaryen#5799]
<https://github.com/WebAssembly/binaryen/pull/5799>
[WebAssembly/binaryen#5813]
<https://github.com/WebAssembly/binaryen/pull/5813>
Interesting OCaml Articles
══════════════════════════
Archive:
<https://discuss.ocaml.org/t/interesting-ocaml-articles/18...>
gasche said
───────────
I had fun reading [Playing with Caml Light on DOS], published today
(it is not obvious from the title).
[Playing with Caml Light on DOS]
<https://www.cambus.net/playing-with-caml-light-on-dos/>
Batteries v3.7.1
════════════════
Archive: <https://discuss.ocaml.org/t/batteries-v3-7-1/13117/1>
UnixJunkie announced
────────────────────
Dear community,
Batteries is a community-maintained extended standard library for
OCaml.
The latest version of batteries is now available in opam: v3.7.1.
This version mostly adds compatibility with ocaml-5.1.0 (thanks to
@kit-ty-kate). Now, batteries relies on dune for compilation (thanks
to Simmo Saan and Gabriel Scherer).
Many thanks to all contributors for this release!
Happy hacking, The batteries maintainers.
Here is the change log for v3.7.1:
v3.7.1 (minor release)
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
• fix CI tests (dune clean && dune build @src/runtest) #1121 (Simo
Saan)
• fix documentation errors for BatSet, BatMap and BatSplay #1120
(Simmo Saan)
• compatibility with OCaml 5.1.0 #1117 (kit-ty-kate)
• bugfix impacting BatString.split_on_string #1112 (Guido Martinez,
review by Francois Berenger)
• add batteries.unthreaded to dune file #1104 (Stephen Sherratt)
• add optional dependency to dune in opam file #1103 (Stephen
Sherratt)
• Finish switch to dune #1098 dune build #1099 dune runtest (Simmo
Saan, review by Francois Berenger)
uri.4.4.0
═════════
Archive: <https://discuss.ocaml.org/t/ann-uri-4-4-0/13119/1>
Calascibetta Romain announced
─────────────────────────────
Yours truly is delighted to announce the release of Uri 4.4.0.
[`ocaml-uri'] is a library for manipulating URIs in accordance with
[RFC 3986]. This announcement allows us to clarify a *breaking change*
in the interpretation of IPv6. Previous versions did not interpret
IPv6 in the `host' part of the URI - we simply escaped the special
characters. This version of `uri' now interprets IPv6 addresses in the
`host' part. This implies a change in the library’s behaviour which
may have some impact on software using this library. This announcement
clarifies this “breaking change”.
The library is available from OPAM: `opam install uri.4.4.0'. From
what we have been able to observe, this breaking-change does not have
a _direct_ impact on the ecosystem. The release went ahead without any
software being broken. However, we would like to warn you of such a
change. The [issues] are open if you notice any unwanted behaviour in
the library.
[`ocaml-uri'] <https://github.com/mirage/ocaml-uri>
[RFC 3986] <https://datatracker.ietf.org/doc/html/rfc3986>
[issues] <https://github.com/mirage/ocaml-uri/issues>
Outreachy December 2023
═══════════════════════
Archive:
<https://discuss.ocaml.org/t/outreachy-december-2023/12949/12>
Deep in this thread, Sudha Parimala said
────────────────────────────────────────
@nikochiko and I have proposed a project to develop a geometric
creative coding library for OCaml. This is heavily inspired by [joy] –
we had loads of fun hacking with it at [Lambda Retreat] (in Scheme)
and want to pass it on to OCaml programmers, and learn a bit about
creative coding in the process. Really excited to work on this.
Outreachy applicants: Please don’t hesitate to get in touch with us if
you’re interested to contribute. :)
Huge thanks to @pitag, @patricoferris and everyone involved, for their
efforts to keep this thriving!
[joy] <https://github.com/fossunited/joy>
[Lambda Retreat]
<https://tarides.com/blog/2023-01-12-lambda-retreat-report/>
Sonja Heinze then said
──────────────────────
As promised, here is the update/summary on this round’s projects. Just
like last round, the OCaml community has signed up with four super
cool projects again. Here are this round’s projects:
• /Implement R*-tree in OCaml/ An R*-tree is a data structure designed
for geospatial use, particularly to be queried for geospatial
objects contained in a given box. It’s super nice to see the
[Geospatial ecosystem for OCaml] thrive. Mentors: @patricoferris ,
@AryanGodara
• /Implement a dark mode for OCaml.org/ It’s a very nice idea to have
a common feature request as an Outreachy project! That makes the
internship very gratifying for the intern. Mentors: @SaySayo ,
@punchagan
• /Improve the GUI experience for OCaml users/ Together with trying
out and possibly improving different GUI libraries in OCaml, that
will entail writing a “Are we GUI yet” page on ocaml.org, similar to
[Are we web yet?]. Those pages are super important, both to
understand the current OCaml ecosystem ourselves and to give an
overview to newcomers. Mentors: @gpetiot, @moazzammoriani
• /Develop a geometric creative coding library in OCaml/ Such a cool
idea, @sudha ! It combines functional programming with creativity
and basic geometry. The idea is to encode and draw 2-dimensional
geometric shapes in a functional style. It’s inspired by Python’s
[joy]. Mentors: @sudha, @nikochiko
Even at the small risk of being annoying: This is a good time for
everyone who might possibly be interested in mentoring to start
thinking about a project for next round :)
[Geospatial ecosystem for OCaml] <https://github.com/geocaml>
[Are we web yet?] <https://ocaml.org/docs/is-ocaml-web-yet>
[joy] <https://github.com/fossunited/joy>
queenshead: a British pub name generator
════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-queenshead-a-british-pub-...>
Raphaël Proust announced
────────────────────────
Just because I could, it doesn’t mean I should have; and yet I did
write an entirely unnecessary generator for names of British pubs.
┌────
│ $ opam install queenshead
│ …
│ $ queenshead
│ The horse and goats
└────
More details on [this short blog post].
It was a good excuse to experiment with `crunch' as a way to embed
some data files in an OCaml program. Turned out to be easy.
[this short blog post]
<https://raphael-proust.gitlab.io/code/queenshead.html>
OCaml behind the scenes: Exception
══════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/watch-ocaml-behind-the-scenes...>
Fabrice announced
─────────────────
To celebrate this talk now being publicly available, I’ve added a
chapter that was not part of the original presentation!
This `Backtraces' section aims to explain how backtraces are
constructed for exceptions, so that exceptions can be linked to the
code location that raised them. It also gives enough details about the
implementation to justify the claims in `Takeaway #5' about backtrace
collection and `raise_notrace'.
It’s a bit technical, so I didn’t dive in *all* the details, but
there’s certainly plenty to understand the technique used.
The updated slides can be found in the release page of the repository:
<https://github.com/fabbing/obts_exn/releases> Feel free to ask me any
questions if anything isn’t clear enough. :slightly_smiling_face:
A memory-polymorphic, polyglot implementation of SplDoublyLinkedList (as transpiled by Pholyglot
0.2-betachicken)
═════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/a-memory-polymorphic-polyglot...>
Olle Härstedt announced
───────────────────────
Added some new features to my hobby compiler project, Pholyglot. :)
Maybe nothing interesting from an OCaml perspective, it’s a pretty
basic amateur home-made compiler system, nothing fancy. The weirdest
aspect of it is that it outputs C-code that is also valid PHP-code, so
called polyglot code (semi-readable).
Since I’m career-locked into PHP, I’m writing myself out of it with my
own compiler.
Another motivation is a slight disappointment in recent languages,
like Rust, which does not, according to me, adhere to the 80/20-rule -
that the most common use-case should be easy, and that in 80% of
cases, you don’t have to be fast, but you should be _able_ to be fast
(instead of forced to be fast). Hence the *opt-out-of-GC* experiment.
The current GC is just Boehm. Might be interesting to try with
ref-count too. Proper tracing is out-of-scope for the project (too
hard… and requires headers etc, can’t combine it with manual memory,
afaik).
Main OCaml src is here:
<https://github.com/olleharstedt/pholyglot/tree/main/src/lib>
Most recent blog post:
<http://olleharstedt.github.io/programming/2023/03/19/memo...>
Packages for making proof assistants
════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/ann-packages-for-making-proof...>
Favonia announced
─────────────────
We are excited to announce the first release of [asai 浅い] on OPAM,
along with new versions of [algaeff] and [yuujinchou友人帳]. We also
released [bwd] and [mugen 無限] on OPAM earlier but didn’t make an
announcement.
All these packages are part of [our research project] to dissect a
typical proof assistant into composable components so that _everyone_
can easily build a high-quality, usable prototype out of their type
checker. It turns out that many components are useful for writing
compilers, too. Here are our packages: (✅ means it’s on OPAM.)
• ✅ [asai 浅い] for compiler diagnostics.
• ✅ [yuujinchou 友人帳] for namespaces and lexical scoping. See my
[TYPES 2022 talk] for its design principles.
• [bantorra] for library management (still under heavy development and
revisions)
• ✅ [mugen 無限] for universe levels. See our [POPL 2023 paper] for a
theoretic analysis of its design.
• [kado カド] for handling cofibrations in Cartesian Cubical Type
Theory. This was also used for implementing [unfolding control].
together with these more general-purpose packages:
• ✅ [algaeff] for well-known composable effects-based gadgets (e.g.,
state, reader, etc.)
• ✅ [bwd] for backward lists
We have a [prototype system] showing how these packages may be used
together. Many packages have been used in our [proof assistant
cooltt], @jonsterling’s ✅ [forester] tool and Topos Institute’s
[polytt]. We invite you to try out our packages the next time you want
to build a proof assistant or compiler!
[asai 浅い] <https://github.com/RedPRL/asai/>
[algaeff] <https://github.com/redprl/algaeff>
[yuujinchou友人帳] <https://github.com/RedPRL/yuujinchou>
[bwd] <https://github.com/RedPRL/ocaml-bwd>
[mugen 無限] <https://github.com/RedPRL/mugen>
[our research project] <http://redprl.org/>
[TYPES 2022 talk] <https://youtu.be/5Cp8jNrWSjI>
[bantorra] <https://github.com/RedPRL/bantorra>
[POPL 2023 paper] <https://doi.org/10.1145/3571250>
[kado カド] <https://github.com/RedPRL/kado>
[unfolding control] <https://arxiv.org/abs/2210.05420>
[algaeff] <https://github.com/RedPRL/algaeff>
[prototype system] <https://github.com/redprl/algaett>
[proof assistant cooltt] <https://github.com/RedPRL/cooltt>
[forester] <https://www.jonmsterling.com/jms-005P.xml>
[polytt] <https://github.com/ToposInstitute/polytt>
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].
[Alan Schmitt]
[send me a message] <mailto:alan.schmitt@polytechnique.org>
[the archive] <https://alan.petitepomme.net/cwn/>
[RSS feed of the archives] <https://alan.petitepomme.net/cwn/cwn.rss>
[caml-list] <https://sympa.inria.fr/sympa/info/caml-list>
[Alan Schmitt] <https://alan.petitepomme.net/>