What is RequireQualifiedAccess attribute?

Maybe a concrete example would help.

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]

From The About F# Page

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.

Tags:

.Net

F#