fslaborg/FSharp.Stats

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

Closed this issue · 2 comments

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 commented

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 👍

@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.