Skip to content

refactor: the Tuple and Option modules of FlatList call the default module by its short name - #48

Open
xperiandri wants to merge 1 commit into
mainfrom
refactor/short-module-names
Open

xperiandri wants to merge 1 commit into
mainfrom
refactor/short-module-names

Conversation

@xperiandri

Copy link
Copy Markdown
Collaborator

Proposed Changes

FlatListTuple.fs and FlatListOption.fs call the default module with FSharp.Collections.Immutable.FlatList.f. Each of the two files opens FSharp.Collections.Immutable, and inside FSharp.Collections.Immutable.Tuple.FlatList (and Option.FlatList) the name FlatList reaches the default module, also for the functions that both modules define, so the full namespace in front of it adds nothing. This pull request writes FlatList.f. Seven references in two files; no other change.

The compiled code is the same. I compared the two builds method by method (944 methods): the opcodes and the called methods match one to one. The tests pass (5 556 test runs on net8.0 and net10.0).

The same change is on the branches of the other collections (their own Tuple and Option files only), and in #31 for IndexedList.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

A style change; no behaviour or signature changes.

Checklist

  • Build and tests pass locally
  • I have added tests that prove my fix is effective or that my feature works (not needed: the IL of both builds is the same)
  • I have added necessary documentation (not needed)

Further comments

A short name is not always safe: in FrozenSet, FrozenSet.f reaches the static class System.Collections.Frozen.FrozenSet of the BCL and does not compile, so the FrozenSet branch keeps the full names. Where the short name does compile, the comparison of the IL is the proof that it reaches the same function.

🤖 Generated with Claude Code

…ault modules by their short names

Each of these files opens `FSharp.Collections.Immutable`, and inside `FSharp.Collections.Immutable.Tuple.FlatList` the name
`FlatList` reaches the default module, also for the functions that both modules define, so the full namespace in front
of it added nothing. The compiled code is the same: the opcodes and the called methods of every method of both builds
match one to one.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant