We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
The community reviewed whether to reopen this question 7 months ago and left it closed:
Original close reason(s) were not resolved
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
这个问题已经回答了一段时间了,但令我感到非常惊讶的是,大多数答案都说 F# 中缺少哪些 OCaml 功能 - 如果您想将现有的 OCaml 程序移植到 F#(这可能是大多数参考文章的动机)。 然而,有许多功能使 F# 成为一种不同的语言(不仅仅是用于 .NET 的 OCaml 的有限版本!)以下是 F# 中添加的一些功能:
+
。老实说,我认为 Visual Studio IDE 也值得一提。 这不是语言的一部分,但它确实改善了用户体验(Visual Studio 中的 IntelliSense 支持真的很好!)
如果你看一下列表,有很多东西很大程度上促进了 F# 的流行,所以它很多不仅仅是“没有函子的 OCaml”。 F# 绝对基于 OCaml(并借鉴了 Haskell 等其他语言的思想),并与它们共享许多方面,但也有很多其他的东西。 我猜想,如果没有异步工作流程、.NET 风格的 OO 和元编程之类的东西,Microsoft 开发人员部门永远不会将 F# 包含在 Visual Studio 2010 中。
This question has been answered for some time now, but I was quite surprised that most of the answers say what OCaml features are missing in F# - this is definitely good to know if you want to port existing OCaml programs to F# (which is probably the motivation of most of the referenced articles). However, there are many features that make F# a different language (not just a limited version of OCaml for .NET!) Here is a couple of things that are added in F#:
+
for all numeric types as well as your types that support it.And, honestly, I think that it is also worth mentioning the Visual Studio IDE. This is not a part of the language, but it really improves the user experience (IntelliSense support in Visual Studio is really good!)
If you look at the list, there are many things that largely contributed to the popularity of F#, so it's much more than just "OCaml without functors". F# is definitely based on OCaml (and takes ideas from other languages such as Haskell) and shares many aspects with them, however there is also a lot of other things. I guess that without things like asynchronous workflows, .NET style OO and meta-programming, the Microsoft Developer Division would never include F# in Visual Studio 2010.
主要区别在于 F# 不支持:
此外,F# 对于标记参数和可选参数具有不同的语法。
理论上,不使用这些功能的 OCaml 程序可以使用 F# 进行编译。 学习 OCaml 是对 F# 的完美合理的介绍(我想反之亦然)。
完整的差异列表是 此处(注意:archive.org 替换了死链接)。
The main differences are that F# does not support:
In addition, F# has a different syntax for labeled and optional parameters.
In theory, OCaml programs that don't use these features can be compiled with F#. Learning OCaml is a perfectly reasonable introduction to F# (and vice versa, I'd imagine).
The complete list of differences is here (note: archive.org replacement of dead link).
F# 和 OCaml 在分类学上属于 ML 语言家族,其中还包括一整套其他奇怪的动物。 F# 比 OCaml 更新,并且它没有任何一个函子 [模块的函数 -> ] 模块]或行类型[对象类和多态变体]。 对于在 .Net 平台上进行开发的人来说,这两种简化可能会使学习曲线变得更容易。 遗憾的是,这两种语言功能在 OCaml 中非常强大,因此阅读 OCaml 文献来深入了解如何为 F# 编写代码可能会导致过早地对后者感到沮丧,因为它可能是 C# 的绝佳替代品(两者都可用)。
F# and OCaml are taxonimically classes in the ML family of languages, which includes a whole passle of other weird animals too. F# is newer than OCaml, and it doesn't have either functors [functions of module -> module] or row types [object classes and polymorphic variants] yet. Between them, those two simplifications probably make the learning curve easier for someone developing on the .Net platform. Sadly, those two language features are hugely powerful in OCaml, so reading the OCaml literature to gain insights into how to code for F# will probably lead to premature frustration with the latter when it's probably an excellent alternative to C# where both are available.