|
|
|
|
|
by zogrodea
925 days ago
|
|
I think the person you're replying to tried to address that point that classes are primarily a way to organise code when other possibly equally good or better options exist like modules. An F# module might (for example) look like below. module Hello =
let say() = "hi" // returns the string "hi" There are mechanisms to encapsulate implementation details (private functions), to have multiple modules for different "domains" and specifying public contracts. A class seems to imply more than that: each class specifies how to create an object with a constructor (where an object is something with the class's methods except modifying some state only owned by and accessible by the object itself). |
|