Skip to content

Commit 0997e5b

Browse files
committed
Finalize release notes for 4.0.0
1 parent 002fd21 commit 0997e5b

File tree

3 files changed

+37
-40
lines changed

3 files changed

+37
-40
lines changed

CHANGES.md

Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,17 @@
1-
unreleased
2-
----------
1+
4.0.0 (2026-03-16)
2+
------------------
33

4-
* atdcat: read from stdin when no input file is given, like `cat`.
4+
* Build: Dune >= 3.18 (April 2025) is now required to build the ATD tools
5+
from source. (#445)
56

6-
* atdml: New `<ocaml private>` and `<ocaml public>` annotations on type
7-
definitions control whether the generated `.mli` declares the type as
8-
`private`:
9-
- `<ocaml private>` on any type (record, sum, alias) forces `private` in the
10-
generated `.mli`.
11-
- `<ocaml public>` on a primitive alias suppresses the default `private`
12-
(see below), making the alias transparent to callers.
13-
The `.ml` implementation is never affected.
14-
15-
* atdml: Unparameterized aliases of primitive types (`unit`, `bool`, `int`,
16-
`float`, `string`) are now translated to OCaml private types in the generated
17-
`.mli`. For example, `type email = string` becomes `type email = private string`
18-
in the interface, so that the compiler names the alias rather than the
19-
underlying type in error messages, and so that direct construction is rejected
20-
outside the generated module. A constructor function is generated:
21-
- `create_email : string -> email`
22-
also exposed as `val create` in the submodule `Email`.
23-
Coercing back to the primitive uses the standard `:>` operator
24-
(e.g. `(x :> string)`). The `.ml` implementation keeps a transparent alias,
25-
so `create_email` is an identity function with no runtime overhead.
26-
27-
* atdml: The `<ocaml field_prefix="pre_">` annotation is now supported on record
28-
types. It prepends the given prefix to all generated OCaml record field names
29-
(e.g. `type point = { p_x: float; p_y: float }`) while keeping the labeled
30-
arguments of the `create_` function unprefixed (e.g.
31-
`create_point ~x ~y () : point`). JSON field names are unaffected.
32-
33-
* atdml: Record creation functions renamed from `make_foo` to `create_foo`
34-
(and `val make` in the submodule to `val create`) to align with the naming
35-
used by the new primitive alias constructors and to match atdgen's convention.
7+
* atdcat: read from stdin when no input file is given, like `cat`.
368

379
* atdts: Dotted module paths in `import` declarations are now mapped to
3810
path-separator form in the generated TypeScript import path. For example,
3911
`import long.module.path` generates `import * as path from "./long/module/path"`
4012
rather than `"./path"`.
4113

42-
* ATD: New `from ... import` syntax replaces the old `import` statement.
14+
* ATD: **Experimental.** New `from ... import` syntax replaces the old `import` statement.
4315
Types to be used must be listed explicitly; the full syntax is:
4416

4517
from module.path <annots> [as alias] import type1 <annots>, type2, ...
@@ -56,6 +28,8 @@ unreleased
5628
- atdpy: alias names that are Python keywords are automatically suffixed
5729
with `_` (e.g. alias `class``class_` in generated code).
5830
- atdgen does not support import statements; use atdml instead.
31+
- A warning is printed to stderr when an imported type name is never
32+
referenced in any type expression.
5933

6034
Examples:
6135

@@ -68,19 +42,23 @@ unreleased
6842
(* Override OCaml module name *)
6943
from mylib.common <ocaml name="Mylib_common"> import date
7044

71-
* atdml: New tool. Generates a single self-contained OCaml module (`.ml` +
45+
* atdml: **Experimental.** New tool. Generates a single self-contained OCaml module (`.ml` +
7246
`.mli`) from a single `.atd` file, with JSON support via `Yojson.Safe.t`.
7347
No separate runtime library is required; the runtime helpers are inlined
7448
into each generated `.ml`. Atdml is the recommended successor to atdgen
7549
for OCaml JSON support.
76-
Supported features in the initial release:
50+
Supported features:
7751
- All primitive ATD types: `unit`, `bool`, `int`, `float`, `string`
7852
- `abstract` type, represented as `Yojson.Safe.t`
7953
- `'a list`, `'a option`, `'a nullable`
8054
- Tuples: `('a * 'b * ...)`
8155
- Records, including required fields, optional fields (`?foo`),
8256
and with-default fields (`~foo`) with implicit or explicit defaults
8357
(`<ocaml default="...">`)
58+
- `<ocaml field_prefix="pre_">` on record types: prepends the given prefix
59+
to all OCaml record field names while keeping the labeled arguments of
60+
`create_` unprefixed (e.g. `create_point ~x ~y () : point`). JSON field
61+
names are unaffected.
8462
- Classic sum types (regular OCaml variants) and polymorphic variants
8563
(`<ocaml repr="poly">`)
8664
- Parametric types
@@ -95,22 +73,31 @@ unreleased
9573
- `<ocaml name="...">` to rename variant constructors in OCaml
9674
- `<ocaml attr="...">` to attach ppx attributes (e.g. `[@@deriving show]`)
9775
to generated type definitions
76+
- `<ocaml private>` on any type definition forces `private` in the generated
77+
`.mli`; `<ocaml public>` on a primitive alias suppresses the default
78+
`private`, making the alias transparent to callers
79+
- Unparameterized aliases of primitive types (`unit`, `bool`, `int`,
80+
`float`, `string`) are generated as `private` in the `.mli`, preventing
81+
direct construction outside the module. A constructor function
82+
`create_email : string -> email` is generated (also exposed as
83+
`val create` in submodule `Email`). Coerce back with `:>`
84+
(e.g. `(x :> string)`).
9885
- `<doc text="...">` documentation annotations, translated into ocamldoc
9986
`(** ... *)` comments in the generated code; supported on type definitions,
100-
record fields, and variant constructors
87+
record fields, variant constructors, and module-level head annotations
10188
- Automatic renaming of ATD type names that conflict with OCaml keywords
10289
or with the `foo_of_yojson`/`yojson_of_foo` naming scheme
10390
- Automatic renaming of record fields and variant constructors that conflict
10491
with OCaml keywords (e.g. `end``end_`)
10592
- `(string * 'a) list <json repr="object">`: encode association lists as
10693
JSON objects `{"key": value, ...}` rather than arrays
107-
- `<doc text="...">` documentation annotations, including module-level
108-
head annotations
10994
- Graceful handling of atdgen annotations not supported by atdml:
11095
`<ocaml module="...">` on type definitions and `<ocaml name="...">` on
11196
record fields emit a warning and are otherwise ignored
11297
- `~field: user_type` with no OCaml default: warns and treats the field as
113-
required in JSON (no `make_` function generated for that type)
98+
required in JSON (no `create_` function generated for that type)
99+
- Record creation functions are named `create_foo` (not `make_foo`),
100+
matching atdgen's convention
114101
- Stdin mode: reads ATD from stdin, writes a copy-pasteable
115102
`module type Types = sig ... end / module Types : Types = struct ... end`
116103
snippet to stdout

doc/atd-language-reference.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,11 @@ imported-type ::= params? lident annot? imported type item
500500
Import declarations
501501
^^^^^^^^^^^^^^^^^^^
502502

503+
.. note::
504+
505+
The ``from ... import`` syntax is **experimental**. The language and
506+
tooling support for imports may still change in future releases.
507+
503508
An ATD file may import individual types from other ATD modules using
504509
``from ... import`` declarations. Import declarations must appear after any
505510
top-level annotations and before any type definitions.

doc/atdml-reference.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Atdml reference
33
================
44

5+
.. note::
6+
7+
Atdml is **experimental**. Its generated interface and the set of
8+
supported features may still change in future releases.
9+
510
Description
611
-----------
712

0 commit comments

Comments
 (0)