Skip to content

Commit cac11e9

Browse files
xperiandriclaude
andcommitted
docs: the compiled name of the FlatList module and the state of main in ADR 0002
The document named `ImmutableArrayModule` as the compiled name of the `FlatList` module in three places. The module compiles as `FlatList`: F# ignores `[<CompiledName>]` on a module, as D2 of ADR 0001 says. The implementation plan and question 7 described `main` before the chain of ADR 0001: one `FlatList` file without a signature, the rewrite only proposed, and a release of the type before the chain starts. The foundation and the `FlatList` pull requests of the chain are on `main` since 2026-10-19, before pull request #28, and release 1.5.0 comes from the API before the chain, without the type. The plan says so, and question 7 keeps the decision and adds what happened and what it means for the first consumer. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
1 parent f5c9598 commit cac11e9

1 file changed

Lines changed: 33 additions & 24 deletions

File tree

‎docsSrc/Explanations/ADR_0002_EquatableArray.md‎

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ readings and show the order of magnitude only.
2020

2121
The maintainers accepted this design and the recommendations of §11 on 2026-10-18. Step 1 of §6 is
2222
[pull request #28](https://github.com/fsprojects/FSharp.Collections.Immutable/pull/28), and its tests (§7) pin the
23-
verified facts. ADR 0001 – Per-collection modules (`ADR_0001_Collection_Modules.md`) proposes to rewrite the
24-
collection modules and is still proposed, in
25-
[pull request #23](https://github.com/fsprojects/FSharp.Collections.Immutable/pull/23); §5 to §7 say where the two
26-
meet.
23+
verified facts. ADR 0001 – Per-collection modules (`ADR_0001_Collection_Modules.md`) rewrites the collection modules. Its
24+
document is [pull request #23](https://github.com/fsprojects/FSharp.Collections.Immutable/pull/23), and its
25+
implementation is on `main` as far as the `FlatList` modules; §5 to §7 say where the two meet.
2726

2827
## Context
2928

3029
`FlatList<'T>` is a type abbreviation of `System.Collections.Immutable.ImmutableArray<'T>`, and the module `FlatList`
31-
(compiled name `ImmutableArrayModule`) is its API. No type of this library has an equality of its own, so a `FlatList`
32-
is compared the way `ImmutableArray` is *(verified)*:
30+
is its API. No type of this library has an equality of its own, so a `FlatList` is compared the way `ImmutableArray` is
31+
*(verified)*:
3332

3433
* **Equality depends on who asks.** F# `=`, `hash` and `HashIdentity.Structural` compare the elements. `.Equals`,
3534
`EqualityComparer<_>.Default`, a default `Dictionary` or `HashSet` and `ValueTuple.Equals` compare the reference of
@@ -96,7 +95,8 @@ create a no-cost wrapper around ImmutableArray that has sequence-equality semant
9695
`FlatList` is for local computation and for signatures shared with .NET code. Moving between them costs nothing.
9796
* Its equality differs from that of F# lists in two visible points: `NaN` elements, and elements that are arrays (§2).
9897
For elements that are arrays, hash-based and sorted collections also disagree on which values are one key (§2).
99-
* Consumers need a new release: nuget.org has only version 1.0.0 from 2020.
98+
* Consumers need a release that has the type: version 1.0.0 from 2020 and release 1.5.0, the API before ADR 0001, do
99+
not have it.
100100

101101
## 1. The type
102102

@@ -332,8 +332,9 @@ The converter for one element type is private and created through `MakeGenericTy
332332
* The attribute is written out because the compiler adds the suffix by itself only next to a non-generic type of the
333333
same name. Next to a generic type alone the module compiles under the plain name *(verified)*, so without the
334334
attribute the compiled name would depend on the factory class.
335-
* The name has the form of `ImmutableArrayModule`. A query translator that recognises the functions of this library by
336-
their compiled declaring type can tell the two modules apart.
335+
* A query translator that recognises the functions of this library by their compiled declaring type can tell the two
336+
modules apart: the `FlatList` module compiles as `FlatList`, because F# ignores `[<CompiledName>]` on a module
337+
(ADR 0001, D2).
337338

338339
Every function of the `FlatList` module exists in `EquatableArray` with the same name, argument order and behaviour and
339340
with `EquatableArray<'T>` in place of `FlatList<'T>`. Each one unwraps, calls the `FlatList` function and wraps, so no
@@ -408,19 +409,23 @@ tests/FSharp.Collections.Immutable.Tests/
408409
* **Public API** has XML documentation under the repository's rules; `CHANGELOG.md` gets an entry under Unreleased, and
409410
the collection lists of `README.md`, `docsSrc/index.md` and `docsSrc/Explanations/Background.md` get the type.
410411
* **Target framework**: the type needs `net8.0`. `CollectionBuilderAttribute` and `System.HashCode` do not exist on
411-
`netstandard2.0`, and System.Text.Json would become a package dependency there. ADR 0001 proposes `net8.0;net10.0`,
412-
which fits. The older local branches (`flat-list` to `indexed-list`) add `netstandard2.0`; should that target ever
413-
come, the type is compiled for `net8.0` and later only.
412+
`netstandard2.0`, and System.Text.Json would become a package dependency there. ADR 0001 sets `net8.0;net10.0`, which
413+
fits. Release 1.5.0, the last one of the API before ADR 0001, targets `netstandard2.0` and `net8.0` and does not have
414+
the type; should `netstandard2.0` ever come back, the type is compiled for `net8.0` and later only.
415+
416+
**Two steps** (question 7). When this design was accepted, the `FlatList` module on `main` was one file without a
417+
signature, and ADR 0001 proposed to rewrite the modules in a chain of pull requests with no release before its end. The
418+
type comes in two steps, so that its first part does not wait for the mirror of a module that the chain rewrites:
414419

415-
**Two steps** (question 7). On `origin/main` the `FlatList` module is one file without a signature. The folder layout,
416-
the full function set, the builder module and the computation expressions exist only on unmerged local branches, and
417-
ADR 0001 proposes to rewrite them in a chain of pull requests with no release before its end.
420+
1. *The type* (pull request #28): the type, the factory class, the converter, the patterns and a module with `empty`,
421+
`singleton`, `ofSeq`, `ofArray`, `ofList`, `ofImmutableArray`, `unsafeOfArray`, `toImmutableArray`, `length`,
422+
`isEmpty` and `map`, with the tests of §7. This is what the first consumer uses.
423+
2. *The mirror of the `FlatList` module*: the mirror of the module, the builder functions and the computation
424+
expression, as one more pull request of that chain (`feat/equatable-array` in D9 of ADR 0001) and under its rules for
425+
layout, function order and tests.
418426

419-
1. *On `main` now* (pull request #28): the type, the factory class, the converter, the patterns and a module with
420-
`empty`, `singleton`, `ofSeq`, `ofArray`, `ofList`, `ofImmutableArray`, `unsafeOfArray`, `toImmutableArray`,
421-
`length`, `isEmpty` and `map`, with the tests of §7. This is what the first consumer uses, and a release can follow.
422-
2. *With the `FlatList` rewrite*: the mirror of the module, the builder functions and the computation expression, as one
423-
more pull request of that chain and under its rules for layout, function order and tests.
427+
The `FlatList` pull requests of the chain were merged on 2026-10-19, before pull request #28. Step 1 is therefore built
428+
on the rewritten `FlatList` module, and question 7 says what that means for the release.
424429

425430
## 7. Test plan
426431

@@ -459,8 +464,8 @@ attributes sorted by type name.
459464
the read-only `IList<'T>` throw `NotSupportedException`.
460465
* **JSON**: the table of §4 under plain System.Text.Json and under FSharp.SystemTextJson, which becomes a test-only
461466
package reference in `Directory.Packages.props`.
462-
* **Mirrored functions** (step 2 of §6): through the shared contract suites that ADR 0001 proposes, if it is accepted,
463-
so that no `FlatList` test is copied.
467+
* **Mirrored functions** (step 2 of §6): through the shared contract suites of ADR 0001 (D8), so that no `FlatList` test
468+
is copied.
464469
* **Assertions**: whole arrays with `Assert.AreEqual` on `EquatableArray` values, whose equality and `ToString ()` make
465470
the failure readable; sizes with `Assert.HasCount` and `Assert.IsEmpty`. `CollectionAssert` does not apply: it needs
466471
the non-generic `ICollection`.
@@ -497,7 +502,7 @@ type; JSON within 10 % of `ImmutableArray<'T>`.
497502
* **`FlatList` users** change nothing. They switch a field to `EquatableArray<'T>` where the value is a key, is compared
498503
or is persisted; stored JSON stays valid (§4).
499504
* **Query translators** that map collection functions by compiled declaring type add
500-
`FSharp.Collections.Immutable.EquatableArrayModule` to the family of `ImmutableArrayModule`.
505+
`FSharp.Collections.Immutable.EquatableArrayModule` next to `FSharp.Collections.Immutable.FlatList`.
501506

502507
## 10. Relation to the RFCs
503508

@@ -555,7 +560,11 @@ The maintainers accepted every recommendation on 2026-10-18. The questions stay
555560
default value. It takes effect under plain System.Text.Json only (§4).
556561
7. **Two steps** (§6): release the type, the patterns and the converter from `main` before the chain of ADR 0001 starts,
557562
or make the type one link of that chain? *Decided: release first.* The first consumer is waiting for a
558-
release, and the chain cuts none before its end.
563+
release, and the chain cuts none before its end. *What happened:* the chain started first. Its foundation and its
564+
`FlatList` pull requests are on `main` since 2026-10-19, before pull request #28, and release 1.5.0 comes from the
565+
branch `release/1.x`, the API before the chain, without the type. The type ships with the first release from `main`
566+
after pull request #28 is merged, and D9 of ADR 0001 cuts none before the end of the chain: the first consumer waits
567+
for that end, or for a decision of the maintainers to release earlier.
559568
8. **Keys with array elements** (decision 5). Accept that equality and comparison disagree on F# arrays, `FlatList`s
560569
and tuples that hold them, or compare such elements by contents, as `.Equals` on an F# list does?
561570
*Decided: accept.* The element keeps the equality that .NET and C# give it. The type needs no list of element

0 commit comments

Comments
 (0)