Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Require Qualified Access documentation has an unclear definition. #319

Open
voronoipotato opened this issue Nov 29, 2018 · 0 comments
Open

Comments

@voronoipotato
Copy link

https://github.com/MicrosoftDocs/visualfsharpdocs/blob/live/docs/conceptual/core.requirequalifiedaccessattribute-class-[fsharp].md

Require Qualified Access uses the word in the definition and therefore provides no useful information.

https://stackoverflow.com/questions/44462268/what-is-requirequalifiedaccess-attribute
I had to read stack overflow to figure out what this actually did.

From F# org

Adding the [<RequireQualifiedAccess>] attribute to a module indicates that the module may not be opened and that references to the elements of the module require explicit qualified access. For example, the Microsoft.FSharp.Collections.List module has this attribute.

This is useful when functions and values in the module have names that are likely to conflict with names in other modules and requiring qualified access can greatly increase the long-term maintainability and evolvability of a library: functions can be added to the module without breaking source compatibility.

example suggestion

The List module has this attribute. This means you're not allowed to open the module:

open List // compile error!

map id [1;2]

Instead, you must do this:

List.map id [1;2]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant