I've been assuming that F# includes the module keyword in addition to the namespace keyword due to backwards compatibility with OCaml. Is this the only reason for the inclusion of the module keyword or are there other reasons module was included?
1 Answer 1
Namespaces are well defined in the .Net universe, and they don't include the things that make up a module, except inside something very much like a module.
Given that they were designing a language to run on the CLR, making it incompatible with other languages would not have made sense.
On a slightly different tangent, namespaces and modules do NOT overlap -- in particular, you can't define another namespace inside a module, and defining another namespace is the sole purpose of namespaces. They may bear a superficial simularity, but they are distinct concepts.
-
@WyattBarnett that would be my guess for namespaces but I'm wondering if there were any other reason to include modules in F# besides OCaml compatibility. Guess I need to ask this on the F# lists.Onorio Catenacci– Onorio Catenacci2012年10月31日 16:54:12 +00:00Commented Oct 31, 2012 at 16:54
-
1Well, a
module
translates to astatic class
.Christopher Stevenson– Christopher Stevenson2014年07月03日 19:18:43 +00:00Commented Jul 3, 2014 at 19:18
let
-bound values and standalone functions.