Modules v. namespaces in F#

前端 未结 1 2126
余生分开走
余生分开走 2021-02-14 23:01

I\'ve got a library written in F#, consumed by C# and F#. this library defines a class foo, in module bar, in namespace random:

         


        
相关标签:
1条回答
  • 2021-02-15 00:00

    If you're publishing F# components for consumption from other .Net languages, then you should avoid modules in the public interfaces, and stick to namespaces containing classes, structs, and enums.

    (Modules are a handy way either to publish values, functions and types among F#-only components, or as 'internal' implementation details of an F# component that publishes .Net classes.)

    (Do see also this question for a discussion of the 'technical distinction' between namespaces and modules. This question and my answer above are more about the 'intentional differences' e.g. when you would choose to use each.)

    0 讨论(0)
提交回复
热议问题