Take the 2-minute tour ×

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?

share|improve this question
stackoverflow.com/questions/795172/… –  Chris Oct 31 '12 at 14:54
@Chris thanks for the link but that's not really my question. I'm asking for the design reasons for the inclusion of two mechanisms that seem to overlap quite a bit. –  Onorio Catenacci Oct 31 '12 at 15:00
CLR namespaces can't hold let-bound values and standalone functions. –  bytebuster Jan 2 '13 at 10:36
add comment

1 Answer

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.

share|improve this answer
+1, CLR compatibility artifact . . . –  Wyatt Barnett Oct 31 '12 at 16:30
@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 Oct 31 '12 at 16:54
add comment

Your Answer


