这个问题总是让我困惑,我无法理解 F# 编译器在这里遇到的问题。
我有两个模块的两个文件。
A.fs:
module A
//rest of the module goes here
Run Code Online (Sandbox Code Playgroud)
B.fs
module A.B
//rest of the module goes here
Run Code Online (Sandbox Code Playgroud)
当我构建这个项目时,我得到:
A.fs(1, 8): [FS0247] A namespace and a module named 'A' both occur in two parts of this assembly
为什么?除了 Program.fs 之外,项目中没有其他任何内容。我是否错误地假设我可以将模块分解为多个文件以控制一切,同时使用命名空间之类的命名方案?(显然编译器是这么认为的)。
我想了解编译器在这里遇到的问题以及为什么我会出现引用命名空间的错误,即使我的代码中没有命名空间声明。