Dot-Net
跨多個文件拆分 F# 模組
是否可以跨文件拆分 F# 模組?
根據我擁有的書,但這本書可能已經過時了(F#的基礎)
顯然不是:
C:\temp\Tim>type 1.fs 2.fs 1.fs #light module Module let sayHello1 = printfn "Hello, " 2.fs #light module Module let sayHello2 = printfn "world!" C:\temp\Tim>fsc 1.fs 2.fs Microsoft F# Compiler, (c) Microsoft Corporation, All Rights Reserved F# Version 1.9.6.2, compiling for .NET Framework Version v2.0.50727 2.fs(2,1): error FS0191: An implementation of the file or module Module has already been given.更新:F# 4.0 中的錯誤發生了變化,現在是:
錯誤 FS0248:名為“模組”的兩個模組出現在此程序集的兩個部分中
where
Module是程序集的完全限定名稱,包括命名空間部分。