What the difference between a namespace and a module in F#? -


I have just started learning F # (with a little bit of prior experience. NET) I'm sorry that maybe one Very Easy Question: What is the difference between Namespace and Module in Free #?

thanks

Dave

EDIT: Thanks for the reply Bryan I wanted to know just one explanation: Can you also open a namespace (C Similar to the use of #)?

A namespace is common, many industrial power languages ​​are common, organizing frameworks and various There is a way to avoid conflicts between libraries. Both you and me can define a type of "foo" and use both in one project, provided they are in different namespaces (eg, ns 1.fu and ns 2.fu). There are types of namespaces in .Net.

A module is an F # thing, it is roughly the same as the "stable class" ... it is a unit that can catch the running values ​​and functions as type ( Note that namespaces can not directly contain values ​​/ functions, namespace can only contain types, which can include values ​​and functions themselves). The objects inside the module can be referred to via "ModuleName.Thing", which is the same syntax for the namespace, but may also be 'opened' to allow modifying modules in F # Like

  open ModuleName // Theory / ModuleName.Thing instead of  

(Edit: Namespaces can also be opened like this, but the fact is That module may contain values ​​and functions, interesting 'm Not, you values ​​and functions, such as "COS", you can use directly, while in other .Net language, you must usually get it qualify, for example "Mathako").

If you type the code at the 'top level' in F #, then this code is contained in a module.

Hope that helps a bit, this is a very open question :)


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -