Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] review / remove [<AutoOpen>] on modules that overlay FSharp.Core collection types. #312

Closed
smoothdeveloper opened this issue Nov 15, 2023 · 2 comments · Fixed by #320

Comments

@smoothdeveloper
Copy link
Contributor

smoothdeveloper commented Nov 15, 2023

A quick note that I suggest to deprecate the [<AutoOpen>] modules that overlays on FSharp.Core Seq/List/Array.

Without going into details, it is discouraged to open those modules in FSharp.Core, and having FSharp.Stats auto open modules of same names, creates some tooling artifacts.

image

See how it says Seq is unused by being dimmed, but the first one?

If this feels reasonable to most, I'd also like to suggest [<RequireQualifiedAccess>] to tip the thing the other direction, users would always specify Seq., etc. or resort on top level apis for modules that don't overlay on FSharp.Core.

@bvenn
Copy link
Member

bvenn commented Nov 15, 2023

I totally agree to remove the AutoOpen tags. However I'm not sure if [<RequireQualifiedAccess>] is necessary, as I have no in-depth experience using it. Although I don't see any problems in principle 👍

@smoothdeveloper
Copy link
Contributor Author

@bvenn, it occurs that those modules in FSharp.Core have the [] attribute.

open Seq;;
-----^^^

error FS0892: This declaration opens the module 'Microsoft.FSharp.Collections.Seq', which is marked as 'RequireQualifiedAccess'. Adjust your code to use qualified references to the elements of the module instead, e.g. 'List.map' instead of 'map'. This change will ensure that your code is robust as new constructs are added to libraries.

I also made a suggestion to component-design-guildelines on F# documentation to be very explicit about the practice of custom modules overlays on existing modules and that would not be consistent in using the attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants