相关疑难解决方法(0)

如何在Visual Studio中组织大型项目的F#源(> 300个类)?

在C#中,您可以将文件放在与其命名空间相对应的文件夹中,并在解决方案资源管理器中查看它们.

在F#中,似乎我必须将所有内容放在简单有序的列表中进行编译.当我达到~300级的规模时,它会让人感到有些困惑和混乱,我开始羡慕C#,并认为它可能是类型推断的代价.

有没有比拆分成几个组件更好的选择?

由F#编译器的源来看它的路线,他们已经采取,但我有互联组件(控制器视图,> 300类 - - 视图模型)的相当大的系统,我想是因为在循环依赖的一个组件,即使在接口水平.

我应该忘记一个文件 - 一个类并创建一些巨大的文件?(例如,在F#编译器中,您有几个100kb到300kb范围内的源文件,并且有些自动生成1Mb左右!)

您对大型F#项目的体验是什么?

f# assemblies code-organization visual-studio c#-to-f#

21
推荐指数
2
解决办法
3161
查看次数

F#是否支持单独文件中的相互依赖的类?

我正在研究IronJS,我们的一个源文件变得越来越长.

现在,我正在努力让.NET互操作.我正在添加TryBinaryOperation方法,Undefined以便C#可以使用未定义值的JavaScript语义.

但是,这会引入对Operators类型的依赖,从而导致循环依赖.

Runtime.fs:

type BoxedValue() =
    struct
        // Contains IsUndefined and get_Undefined, referencing the Undefined class, below.

...

and type Undefined() =
    inherit DynamicObject()
    ...
    override x.TryBinaryOperation(binder:BinaryOperationBinder, arg:obj, result:obj byref) : bool =
        // Here, we are referencing BoxedValue, above.
        result <- Operators.add(Und, BoxedValue.Box(arg))
        true

...
Run Code Online (Sandbox Code Playgroud)

Operators.fs:

type Operators =
    ...
    // Here, we are referencing BoxedValue.
    static member add(BoxedValue l, BoxedValue r)
        ...
Run Code Online (Sandbox Code Playgroud)

所以,我们有这组依赖:
BoxedValue-> Undefined,Undefined-> BoxedValue,Undefined-> Operators,Operators-> BoxedValue

理想情况下,我们希望将每个文件拆分为自己的文件.

F#中是否可能存在跨文件循环依赖关系?

f# circular-dependency

10
推荐指数
1
解决办法
1099
查看次数