有没有办法自动打开外部定义的模块?我希望它可以在整个项目中使用而无需在每个文件中打开它.这样的事情是理想的:
[<AutoOpen>]
module MyModule = YourNamespace.YourModule //ERROR: Ignoring attributes on module abbreviation
Run Code Online (Sandbox Code Playgroud)
我也尝试了这个,它(假设)将外部定义的模块作为新模块的公共接口的一部分.
module MyModule =
module public YourModule = YourNamespace.YourModule //ERROR: Ignoring accessibility attribute on module abbreviation. Module abbreviations are always private.
Run Code Online (Sandbox Code Playgroud)
这是一个很好的问题——允许这样做是有道理的。另一种方法是使用一些编译器参数来自动打开命名空间/模块,但我认为目前还没有。
(似乎没有比我在评论中写的更好的答案,所以我将其复制为答案)
| 归档时间: |
|
| 查看次数: |
271 次 |
| 最近记录: |