F# code organization: types & modules

后端 未结 4 1916
抹茶落季
抹茶落季 2020-12-24 02:52

How do you decide between writing a function inside a module or as a static member of some type?

For example, in the source code of F#, there are lots of types that

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-24 03:30

    In F# I prefer a static member on a type over a function in a module if ...

    1. I have to define the type irrespective of the member
    2. The member is functionally related to the type I'm defining

提交回复
热议问题