【发布时间】:2011-01-22 05:40:26
【问题描述】:
我知道otherquestions 关于 F# 中的模块和命名空间,但它们现在对我没有帮助。
我有一个项目
Utilities.fs
namespace Company.Project.Namespace
module Utilities =
//stuff here
Functions.fs
namespace Company.Project.Namespace
open Utilities
module Functions =
//stuff here
我正在尝试在 fsx 中测试它们:
#load "Utilities.fs"
#load "Functions.fs"
当我尝试使用 Alt-Enter 将其发送到 FSI 时,这给了我 error FS0039: The namespace or module 'Utilities' is not defined。
我尝试在脚本文件的顶部添加相同的命名空间,但不喜欢这样。
奇怪的是后台编译器并没有对我大喊大叫。
这似乎可行,但它是正确的方法吗?
#load "Utilities.fs"
open Company.Project.Namespace
#load "Functions.fs"
在某处是否有“参考”FSharp 项目,其中包含如何集成所有这些东西的示例:命名空间、模块、类、脚本文件、测试等?
【问题讨论】:
标签: f# namespaces module projects-and-solutions f#-interactive