OCaml Changelog

RSS

Read the latest releases and updates from the OCaml ecosystem.

The ppxlib team is happy to announce the release of ppxlib.0.32.1.

The main feature of this release is of course the support for the upcoming OCaml 5.2 release. Starting with this version you'll be able to use ppx with the latest compiler.

The feature also comes with a small follow up improvement to the 0.32.0 error reporting changes that simplifies how exception thrown from context free rewriting are handled. The errors will now be inserted where the generated code would have been instead of appended to the whole AST. This should lead to a better error reporting from the compiler as it will now report errors in order of their position in the code.

We'd like to thank the OCaml Software Foundation once again as they funded the vast majority of the work for this release.

See full changelog
  • Add support for OCaml 5.2

  • Insert errors from caught located exceptions in place of the code that should have been generated by context-free rules. (#472, @NathanReb)

The ppxlib dev team is happy to announce the release of ppxlib.0.32.0.

The main feature of this release, implemented by @burnleydev1 during their Outreachy internship, is a huge improvement of the handling of located exceptions raised by ppx-es. Whenever a rewrite of the AST throws such an exception, the ppxlib driver catches it and resumes the rewriting using the latest valid AST it knows of. All caught exceptions are appended to the final AST as [%%ocaml.error ..] nodes. This means the driver returns a valid AST instead of one composed of a single error node corresponding to the first raised exception. This leads to a much better experience for ppx users as merlin now has a valid AST to work with when this happens, allowing it to properly function, reporting all errors, from ppx-es or otherwise. Note that despite this change we still recommend ppx authors to embed errors in the rewritten AST rather than throw exceptions.

The release also comes with a few bug fixes on longident parsing or windows compatibility and a new simplified API for ppx authors using attributes as flags (i.e. attributes without payloads such as [@ignore] for instance).

We'd like to thank our external contributors for this release:

  • @burnleydev1 for their improvement of the driver exception handling
  • @dianaoigo for their addition of the new attribute flags API
  • @jonahbeckford for their fix of the windows compatibility

We'd also like to thank the OCaml Software Foundation who has been funding my work on this release.

See full changelog
  • Add an optional embed_errors argument to Context_free.map_top_down that controls how to deal with exceptions thrown by context-free rules. (#468, @NathanReb)

  • Fix Longident.parse so it properly handles unparenthesized dotted operators such as +. or *.. (#111, @rgrinberg, @NathanReb)

  • raising an exception does no longer cancel the whole context free phase(#453, @burnleydev1)

  • Sort embedded errors that are appended to the AST by location so the compiler reports the one closer to the beginning of the file first. (#463, @NathanReb)

  • Update Attribute.get to ignore loc_ghost. (#460, @ceastlund)

  • Add API to manipulate attributes that are used as flags (#408, @dianaoigo)

  • Update changelog to use ISO 8061 date format: YYYY-MM-DD. (#445, @ceastlund)

  • Replace Caml with Stdlib. (#427, @ceastlund)

  • When a transformation raises, the last valid AST is used as input to the upcoming transformations. All such errors are collected and appended as extension nodes to the final AST (#447, @burnleydev1)

  • Fix a small mistake in the man pages: Embededding errors is done by default with -as-pp, not with -dump-ast (#464, @pitag-ha)

  • Set appropriate binary mode when writing to stdout especially for Windows compatibility. (#466, @jonahbeckford)

We're happy to announce the release of Ppxlib 0.31.0. Shortly after OCaml 5.1.0 has been released, this Ppxlib release fixes a bug in the support of OCaml 5.1.0. Before that bug fix, the warnings about a generative/applicative mismatch between a functor creation and its application introduced by OCaml 5.1.0 were also triggered when that mismatch didn't exist.

Furthermore, the release contains a couple of bug fixes in the context of attributes.

We're also excited about two main enhancements. One allows authors of extension node rewriters to add a path argument to the extension node. That's excellent for hygiene since it allows the PPX to be explicit about modules rather than depending on its scope.

The other main enhancement allows an opt-in for compiler warnings about unused code generated by derivers (warnings w32 and w60). That opting in needs to happen on both sides of the deriver, the writer side and the user side. Opting in to those code warnings will help to clean up unused code, leading to performance improvements in compilation and editor support.

See full changelog
  • Fix support for OCaml 5.1: migrated code preserves generative functor warnings, without creating more. Locations are better preserved. (#432, @pitag-ha, @panglesd)

  • Driver: Add -unused-code-warnings command-line flag. (#444, @ceastlund)

  • Add ?warning flag to Deriving.Generator.make. (#440, @jacksonzou123 via @ceastlund)

  • Restore the path_arg functionality in the V3 API. (#431, @ELLIOTTCABLE)

  • Expose migration/copying/etc. functions for all AST types needed by Pprintast. (#454, @antalsz)

  • Preserve quoted attributes on antiquotes in metaquot. (#441, @ncik-roberts)

  • Attribute namespaces: Fix semantics of reserving multi-component namespaces. (#443, @ncik-roberts)

Ppxlib 0.30.0

We're excited to announce the release of Ppxlib 0.30.0! It comes with support for OCaml 5.1, various enhancements, and bug fixes.

For PPX writing, Ast_pattern now offers additional utility functions, while metaquot benefits from improved error reporting.

PPX usage sees better compatibility with OCaml trunk, thanks to the Driver's improved Parsetree version recognition. This allows for compatibility with both trunk and stable OCaml versions concurrently.

Finally, this release enhances Ppxlib's compatibility with ReScript, introducing "ns" and "res" as reserved namespaces.

See full changelog

Ppxlib 0.29.1

See full changelog
  • Allow users to vendor ppxlib as-is, as well as ppx_sexp_conv in the same project (#386, @kit-ty-kate)

Ppxlib 0.29.0

See full changelog
  • Remove File_path exports. (#381, @ceastlund)
  • Add Ppxlib.Expansion_helpers with name mangling utilities from ppx_deriving (#370, @sim642)

Ppxlib 0.28.0

See full changelog
  • Make esequence right-associative. (#366, @ceastlund)
  • Deprecate unused attributes in Deriving.Generator (#368, @sim642)
  • Remove a pattern match on mutable state in a function argument. (#362, @ceastlund)
  • Add code-path manipulation attributes. (#352, @ceastlund)
  • Update context-free rules to collect expansion errors generated by ppxlib and propagate them to top level without failing. (#358 and #361, @ceastlund)
  • Add driver benchmarks (#376, @gridbugs)

Ppxlib 0.25.1

See full changelog
  • Update expansion context to leave out value name when multiple are defined at once. (#351, @ceastlund)
  • Add support for OCaml 5.0 (#348, @pitag-ha)
  • Add Code_path.enclosing_value (#349, @ceastlund)
  • Add Code_path.enclosing_module (#346, @ceastlund)
  • Expand code generated by ~enclose_intf and ~enclose_impl (#345, @ceastlund)
  • Add type annotations to code generated by metaquot (#344, @ceastlund)
  • Fix typo in description field of dune-project (#343, @ceastlund)
  • Fix Ast_pattern.many (#333, @nojb)
  • Fix quoter and optimize identifier quoting (#327, @sim642)
  • Driver, when run with --check: Allow toplevel_printer attributes (#340, @pitag-ha)
  • Documentation: Add a section on reporting errors by embedding extension nodes in the AST (#318, @panglesd)
  • Driver: In the case of ppxlib internal errors, embed those errors instead of raising to return a meaningful AST (#329, @panglesd)
  • API: For each function that could raise a located error, add a function that return a result instead (#329, @panglesd)

Ppxlib 0.27.0

See full changelog
  • Bump ppxlib's AST to 4.14/5.00 (#320, @pitag-ha)

Ppxlib 0.26.0

See full changelog
  • Add support for OCaml 5.0 (#355, @pitag-ha)

Ppxlib 0.25.0

See full changelog
  • Added error_extensionf function to the Location module (#316, @panglesd)
  • Ast patterns: add drop and as patterns (#313 by @Kakadu, review by @pitag-ha)
  • Fixed a bug resulting in disscarded rewriters in the presence of instrumentations, as well as a wrong order of rewriting (#296, @panglesd)
  • Driver: Append the last valid AST to the error in case of located exception when embedding errors (#315, @panglesd)

Ppxlib 0.24.0

See full changelog
  • Add support for OCaml 4.14 (#304, @kit-ty-kate)
  • Expand nodes before applying derivers or other inline attributes based transformation, allowing better interactions between extensions and derivers (#279, #297, @NathanReb)
  • Add support for registering ppx_import as a pseudo context-free rule (#271, @NathanReb)
  • Add input_name to the Expansion_context.Extension and Expansion_context.Deriver modules (#284, @tatchi)
  • Improve gen_symbol to strip previous unique suffix before adding a new one (#285, @ceastlund)
  • Improve name_type_params_in_td to use prefixes a, b, ... instead of v_x. (#285, @ceastlund)
  • Fix a bug in type_is_recursive and really_recursive where they would consider a type declaration recursive if the type appeared inside an attribute payload (#299, @NathanReb)

Ppxlib 0.23.0

See full changelog
  • Drop Parser from the API (#263, @pitag-ha)
  • Location: add set_filename and Error.get_location (#247, @pitag-ha)
  • Drop dependency on OMP2 (#187, @pitag-ha)
  • Make OMP1 a conflict (#255, @kit-ty-kate)
  • Drop Syntaxerr from the public API. Doesn't affect any user in the ppx universe (#244, @pitag-ha)
  • Add a lower-bound constraint for Sexplib0 (#240, @pitag-ha)
  • Fix bug due to which unwanted public binaries got installed when installing ppxlib (#223, @pitag-ha)
  • Add Keyword.is_keyword to check if a string is an OCaml keyword (#227, @pitag-ha)
  • Remove Lexer.keyword_table: use Keyword.is_keyword instead (#227, @pitag-ha)
  • Remove Lexer from the API: it was the same as the compiler-libs Lexer (#228, @pitag-ha)
  • Remove the modules Ast_magic, Compiler_version, Js, Find_version, Convert, Extra_warnings, Location_error, Select_ast and Import_for_core from the API: they are meant for internal use and aren't used by any current downstream user in the ppx universe (#230, @pitag-ha)
  • Remove compiler specific helper functions from Location. They aren't used by any current downstream user in the ppx universe (#238, @pitag-ha)
  • Allow "%a" when using Location.Error.createf (#239, @mlasson)
  • Fix in Location: make raise_errorf exception equivalent to exception Error (#242, @pitag-ha)
  • Fix in Pprintast: correctly pretty print local type substitutions, e.g. type t := ... (#261, @matthewelse)
  • Add Ast_pattern.esequence, for matching on any number of sequenced expressions e.g. do_a (); do_b (); .... (#264, @matthewelse)
  • Expose a part of Ast_io in order to allow reading AST values from binary files (#270, @arozovyk)

Ppxlib 0.22.2

See full changelog
  • Make ppxlib compatible with 4.13 compiler (#260, @kit-ty-kate)

Ppxlib 0.22.1

See full changelog
  • Fix location in parse error reporting (#257, @pitag-ha)

Ppxlib 0.21.1

See full changelog
  • Fix location in parse error reporting (#256, @pitag-ha)

Ppxlib 0.22.0

See full changelog
  • Bump ppxlib's AST to 4.12 (#193, @NathanReb)

Ppxlib 0.21.0

See full changelog
  • Fix ppxlib.traverse declaration and make it a deriver and not a rewriter (#213, @NathanReb)
  • Driver (important for bucklescript): handling binary AST's, accept any supported version as input; preserve that version (#205, @pitag-ha)
  • -as-ppx: take into account the -loc-filename argument (#197, @pitag-ha)
  • Add input name to expansion context (#202, @pitag-ha)
  • Add Driver.V2: give access to expansion context in whole file transformation callbacks of register_transformation (#202, @pitag-ha)
  • Driver: take -cookie argument into account, also when the input is a binary AST (@pitag-ha, #209)
  • run_as_ppx_rewriter: take into account the arguments -loc-filename, apply and dont-apply (#205, @pitag-ha)
  • Location.Error: add functions raise and update_loc (#205, @pitag-ha)

Ppxlib 0.20.0

See full changelog
  • Expose Ppxlib.Driver.map_signature (#194, @kit-ty-kate)

Ppxlib 0.19.0

See full changelog
  • Make ppxlib compatible with 4.12 compiler (#191, @kit-ty-kate)

Ppxlib 0.18.0

See full changelog
  • Bump ppxlib's AST to 4.11 (#180, @NathanReb)

Ppxlib 0.17.0

See full changelog
  • Add accessors for code_path and tool_name to Expansion_context.Base (#173, @jberdine)
  • Add cases methods to traversal classes in Ast_traverse (#183, @pitag-ha)

Ppxlib 0.16.0

See full changelog
  • Driver.register_transformation: add optional parameter ~instrument (#161, @pitag-ha)
  • Add missing Location.init (#165, @pitag-ha)
  • Upgrade to ocaml-migrate-parsetree.2.0.0 (#164, @ceastlund)

Ppxlib 0.15.0

See full changelog
  • Remove base and stdio dependencies (#151, @ceastlund)
  • Update README and opam description (#155, @jeremiedimino)
  • Fix Driver.partition_transformation (#156, @NathanReb)
  • Implement name mangling for ppxlib_traverse (#159, @ceastlund)

Ppxlib 0.14.0

See full changelog
  • Bump ppxlib's AST to 4.10 (#130, @NathanReb)
  • Remove omp_config from Expansion_context and replace it with tool_name (#149, @NathanReb)
  • Change undocumented Ppxlib.Driver.map_structure to return a ppxlib's structure instead of a Migrate_parsetree.Driver.some_structure. (#153, @NathanReb)

Ppxlib 0.13.0

See full changelog
  • Add 'metaquot.' prefix to disambiguate metaquote extensions (#121, @ceastlund)
  • Bump dune language to 1.11 since the cinaps extension requires at least Dune 1.11 (#126, @diml)

Ppxlib 0.11.0

See full changelog
  • Invariant check on locations (#107, @trefis)

Ppxlib 0.10.0

See full changelog
  • Do not produce a suprious empty correction when deriving_inline expands into an extension that undergoes further expansion (#86, @aalekseyev)
  • Add Ppxlib.Quoter. This module allows to generate hygienic code fragments in the spirit of ppx_deriving. (#92, @rgrinberg)
  • Allow for registering derivers on module type declarations. (#94, fix #83, @rgrinberg)
  • Fix parsing long idenitifiers. (#98, @NathanReb)
If you want to contribute to a new release announcement, check out the Contributing Guide on GitHub.