简体   繁体   English

为什么在 Visual Studio 2010 中安装了 F# 运行时?

[英]Why is there an F# Runtime being installed with Visual Studio 2010?

I'm installing Visual Studio 2010 on a new machine and took a list of the default Components installed.我正在一台新机器上安装 Visual Studio 2010,并列出了安装的默认组件。

Among them, there is 'Visual Studio F# 2.0 Runtime', which seems strange, because as far as I knew, all .NET languages get compiled to MSIL and are then treated equally (this is obviously not right, since there is a F# Runtime).其中有'Visual Studio F# 2.0 Runtime',看起来很奇怪,因为据我所知,所有.NET语言都会被编译成MSIL然后被平等对待(这显然不对,因为有一个F# Runtime )。

So here my question arises: Aren't all the languages compiled to MSIL?所以这里出现了我的问题:不是所有的语言都编译为 MSIL 吗? If that was the case, that would mean the Runtime analyzer should be the same for any language, doesn't it?如果是这样,那将意味着运行时分析器对于任何语言都应该是相同的,不是吗? Why is F# treated differently from the other languages, if that is really the case?为什么 F# 与其他语言的处理方式不同,如果确实如此?

Any thoughts will be appreciated!任何想法将不胜感激!

C# and VB have runtimes, too. C# 和 VB 也有运行时。 They are just DLLs - .NET MSIL assemblies.它们只是 DLL - .NET MSIL 程序集。 It just happens that the F# runtime is not a part of the .NET framework (it's a separate component), whereas the C# and VB runtimes are part of the framework (and thus are already installed as part of .NET).碰巧 F# 运行时不是.NET 框架的一部分(它是一个单独的组件),而 C# 和 VB 运行时是框架的一部分(因此已经作为 .NET 的一部分安装)。

(I don't know exactly what's in the VB runtime, I think a bunch of VB-specific functions. The C# runtime, Microsoft.CSharp.dll, is just used for dynamic , I think. The F# runtime, FSharp.Core.dll, has all kinds of stuff, like functions, lists, async, all the F# stuff that is not part of .NET proper. (我不知道 VB 运行时到底是什么,我认为是一堆 VB 特定的函数。我认为 C# 运行时 Microsoft.CSharp.dll 仅用于dynamic 。F# 运行时 FSharp.Core。 dll,有各种各样的东西,比如函数、列表、异步、所有不属于 .NET 的 F# 东西。

Calling these things 'runtimes' is maybe a source of confusion, they're just "libraries", but without these libraries, you will be restricted to using only a subset of the language.将这些东西称为“运行时”可能会引起混淆,它们只是“库”,但是如果没有这些库,您将被限制只能使用该语言的一个子集。 In C#, without a runtime, you can't use dynamic.在 C# 中,如果没有运行时,就不能使用动态。 In F#, without a runtime, there is very little you can do, maybe define some classes and simple methods, but nothing using lists or higher-order functions or certain language constructs.在 F# 中,如果没有运行时,您可以做的很少,也许可以定义一些类和简单的方法,但不能使用列表或高阶函数或某些语言结构。 I don't know about VB.我不知道VB。 I guess in general, a library should be labeled part of a 'language runtime' if the language's compiler will generate code that assumes that library is there.我想一般来说,如果语言的编译器将生成假定该库存在的代码,那么该库应该被标记为“语言运行时”的一部分。 So .NET stuff like mscorlib.dll can probably be properly called part of the shared runtime of all the languages (eg to support things like the int keyword in C#) whereas other libraries are just there to support a specific feature of a specific language (like Microsoft.CSharp.dll to support dynamic ).)因此,像 mscorlib.dll 这样的 .NET 东西可能可以被正确地称为所有语言的共享运行时的一部分(例如,支持 C# 中的int关键字之类的东西),而其他库只是为了支持特定语言的特定功能(像 Microsoft.CSharp.dll 支持dynamic )。

As aside-trivia, Visual Studio installs the F# Runtime because parts of the F# IDE integration in Visual Studio are written in F#, and thus VS needs F# to run.顺便说一句,Visual Studio 安装了 F# 运行时,因为 Visual Studio 中的部分 F# IDE 集成是用 F# 编写的,因此 VS 需要 F# 才能运行。 (The F# project system is partly authored in C#, partly in F#, and partly in VB.) Similarly, VS installs .NET 4.0, because a lot of VS components are written in C# and VB - there is a lot of managed code running inside VS. (F#项目系统部分用C#编写,部分用F#编写,部分用VB编写。)同样,VS安装.NET 4.0,因为VS的很多组件都是用C#和VB编写的——有很多托管代码在运行内VS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM