F # compilation issues fixed after changing file position back and forth and strange naming behavior
I am using the Power F # tools which give me a convenient way to create folders in an F # solution.
Now I have 2 similar console app projects in a solution. Both projects contain a util folder. One project folder contains a named module with functions. Another project utility folder contains the enum name and class definition.
The namespace is done like this: ProjectName.Folder
Both projects have a Program.fs file with the main EntryPoint function. Program.fs is the last file in the solution. The main function is inside the ProjectName namespace.
Since both files have the same root namespace, I expect to see the subnamespace from Program.fs when I try to "open" the subnamespace and use code from another file.
Ok, that works in the first project with a module, but not another that contains class definitions in the sub-namespace ... when I try to open the sub-namespace in the second project, I need to provide a fully qualified namespace, even though both files have one and the same namespace root.
In the first project, I can directly reference the sub-namespace without specifying the root namespace - it's just visible.
This confuses me, especially since sometimes I have compilation problems which I solve by moving the Program.fs file with main () up and down in the project, and suddenly I can compile.
Do you have any ideas if the problems described are related to problems in the project structure (file) that are not visible in the solution explorer, or I don't see something related to the F # syntax and how to use (open) modules with a namespace with functions that work versus for class names (types)? Could it be that F # powertools is somehow causing problems when creating folders and files inside those folders?
I can provide code samples. They are mostly taken from the tutorial, but I wanted to keep the question as short as possible.
Edit 1
I just merged the code in a new project to test everything, and as it turns out, when I open with a namespaced module, it can only provide the namespaced relative path to that module, but when I open the namespace. in order to use the classes defined there, I need to provide the full path of that namespace, although I open this namespace from the same root namespace. Can anyone confirm this behavior? Meanwhile, I'm going to dig out http://en.wikibooks.org/wiki/F_Sharp_Programming/Modules_and_Namespaces
source to share
Regarding the order of the folder files, check the actual fsproj with the xml editor. For me PowerTools created the correct file path, i.e. Folder \ MyFile.fs, but put it in the wrong place. All files in the folder should be displayed immediately one after the other. For example, you cannot do this order:
FolderA \ File1.fs, File2.fs, FolderA \ File3.fs
source to share