My take is that replacing a language as rich and mature as C# would be very expensive. So, for example, at the moment, C# is absolutely the best choice for WinForms development if using the Visual Studio WinForms designer can give you an advantage: F# has no WinForms designer.
C# also has better LINQ-to-SQL support at the moment. I'm sure there are many other examples along these lines.
Then there is requiring the entire C# skilled workforce to update their skills to F#, while preserving C# skills for maintaining applications, again expensive.
Finally, C# is an excellent language with a lot of great features, some F# doesn't even have like co/contra variant generics and out of the box support for dynamic programming against the DLR (F# just has an unimplemented operator).
So by not expecting F# to replace C#, F# can evolve in new ways instead of spending all it's time playing catch-up in areas already well-covered.
可用的语言给定库 - 如果您想限制自己只使用 F# 以及与其配合良好的库,那么域会缩小一点。例如,LINQ to SQL 和 ASP.NET MVC 可以与 F# 一起使用,但它并不完美。然而,对于许多项目来说,开发自己的库是有意义的,然后 F# 就成为了很好的语言。
This is a tricky question, because it isn't very well qualified. Are you talking about the language in general, or are you talking about the language together with current IDE support? Or are you talking about using F# given the libraries available?
Language in general - I don't think there are areas where using F# would be an absolute nonsense. It would be great for systems programming of fully managed OS (e.g. Singularity) and I think that functional programs would be easier to verify formally (which could be a big deal for OS). For low-level embedded systems, you could use meta-programming and langauge-oriented facilities (e.g. to model signal flow in hardware etc.)
Language with current IDE - The current F# IDE has some limitations - it doesn't work with WinForms designer (but it works well with Blend and WPF).
Language given developer education - It is more difficult to hire F# programmers than to hire C# programmers. If you're creating some application that doesn't have any complicated core (e.g usual "interface for a database") then developing it in C# will be cheaper (If you could hire good F# developers they would likely finish it faster and with less bugs, but it may not be worth the cost).
Language given libraries available - If you want to restrict yourself to using F# with just libraries that work well with it then the domain shrink a bit more. For example, LINQ to SQL and ASP.NET MVC can be used with F#, but it isn't perfect. However, for many projects it would make sense to develop your own libraries and then F# becomes great language for that.
Good question. I'd say that there are zero language reasons and many unfortunate skill-set, aptitude, and attitude reasons on the part of developers, managers, and customers.
Many of Microsoft's UI technologies such as WPF have excellent support for databinding. Effective databinding uses two-way binding to update the underlying objects when the user interacts with the UI. This implies that effective databinding requires mutable objects.
F#, with its emphasis on immutable types, is a pretty poor match to that type of databinding model. While it's possible to create mutable types in F#, doing so would remove a lot of the benefits from the language. It simply makes better sense to use a language (such as C#) where mutability comes more natural.
If you're willing to give up tools particular to C#, and pay whatever cost of adoption is applicable, there is no particular area where F# would not be at least as capable as C#.
Well, at the risk of stating the obvious, F# is first and foremost a functional programming language and OOP programming in F# can be a pain in the neck. So if you're working with a problem that is best expressed with OOP I imagine using C# does make more sense.
Mutually recursive types and explicit implementation of interfaces are the first examples off the top of my head of why OOP in F# can be cumbersome.
An (often cited) example of "problem that is best expressed with OOP" is creating a UI library. You have many widgets, which encapsulate their own state and you want to ask them to do a few things like "draw yourself" polymorphically (is that even a word?)
Web 应用程序中的框架(例如 ASP.NET MVC)更适合 C#。 “绝对没有意义”是一个极端,我会说“正常情况下”。
当然,它可以用于 Web 应用程序引用的库,但不能用于实际应用程序本身。
Web Applications where Frameworks e.g. ASP.NET MVC lend themselves better to C#. "Absolutely no sense" is an extreme, I would say "under normal circumstances."
Of course it could be used for libraries that the web application referenced, but not the actual application itself.
Until f# is fully supported by Visual Studio (ASP.NET, WebForms, WPF, etc) and third party tools, f# will always be a second class citizen.
Let's face it, language choice usually doesn't make much difference to productivity when compared to a solid library (.NET, available to both c# and f# - no advantage to either here), the IDE (intellisense, syntax coloring, etc), (only partially support available to f# as far as I know... e.g. no Razor support), and third party tools (e.g. resharper).
So with that in mind, I don't think anyone can recommend a complete replacement of c# until all of those tools are in place for f#. A good compromise is to use f# in class libraries and continue to use c# on the front end.
发布评论
评论(9)
我的看法是,更换像 C# 这样丰富和成熟的语言将非常昂贵。因此,例如,目前,如果使用 Visual Studio WinForms 设计器可以给您带来优势,那么 C# 绝对是 WinForms 开发的最佳选择:F# 没有 WinForms 设计器。
C# 目前还具有更好的 LINQ-to-SQL 支持。我确信还有很多其他类似的例子。
然后,需要所有 C# 技术人员将其技能更新为 F#,同时保留用于维护应用程序的 C# 技能,这同样是昂贵的。
最后,C# 是一种优秀的语言,具有许多出色的功能,一些 F# 甚至没有像 co/contra 变体泛型和针对 DLR 的动态编程的开箱即用支持(F# 只是有一个未实现的运算符)。
因此,通过不期望 F# 取代 C#,F# 可以以新的方式发展,而不是花费所有时间在已经广泛覆盖的领域中追赶。
My take is that replacing a language as rich and mature as C# would be very expensive. So, for example, at the moment, C# is absolutely the best choice for WinForms development if using the Visual Studio WinForms designer can give you an advantage: F# has no WinForms designer.
C# also has better LINQ-to-SQL support at the moment. I'm sure there are many other examples along these lines.
Then there is requiring the entire C# skilled workforce to update their skills to F#, while preserving C# skills for maintaining applications, again expensive.
Finally, C# is an excellent language with a lot of great features, some F# doesn't even have like co/contra variant generics and out of the box support for dynamic programming against the DLR (F# just has an unimplemented operator).
So by not expecting F# to replace C#, F# can evolve in new ways instead of spending all it's time playing catch-up in areas already well-covered.
这是一个棘手的问题,因为它的资格不是很好。您是在谈论一般语言,还是在谈论该语言以及当前的 IDE 支持?或者考虑到可用的库,您正在讨论使用 F# 吗?
一般语言 - 我不认为在某些领域使用 F# 绝对是无稽之谈。这对于完全托管操作系统(例如奇点)的系统编程来说非常有用,而且我认为功能性程序更容易进行形式验证(这对于操作系统来说可能是一件大事)。对于低级嵌入式系统,您可以使用元编程和面向语言的设施(例如,对硬件中的信号流进行建模等)
当前 IDE 的语言 - 当前的 F# IDE 有一些限制 - 它不适用于 WinForms 设计器(但它适用于 Blend 和 WPF)。
开发人员教育语言 - 雇用 F# 程序员比雇用 C# 程序员更困难。如果您正在创建一些没有任何复杂核心的应用程序(例如通常的“数据库接口”),那么用 C# 开发它会更便宜(如果您可以雇用优秀的 F# 开发人员,他们可能会更快地完成它并且花费更少bug,但可能不值得付出代价)。
可用的语言给定库 - 如果您想限制自己只使用 F# 以及与其配合良好的库,那么域会缩小一点。例如,LINQ to SQL 和 ASP.NET MVC 可以与 F# 一起使用,但它并不完美。然而,对于许多项目来说,开发自己的库是有意义的,然后 F# 就成为了很好的语言。
This is a tricky question, because it isn't very well qualified. Are you talking about the language in general, or are you talking about the language together with current IDE support? Or are you talking about using F# given the libraries available?
Language in general - I don't think there are areas where using F# would be an absolute nonsense. It would be great for systems programming of fully managed OS (e.g. Singularity) and I think that functional programs would be easier to verify formally (which could be a big deal for OS). For low-level embedded systems, you could use meta-programming and langauge-oriented facilities (e.g. to model signal flow in hardware etc.)
Language with current IDE - The current F# IDE has some limitations - it doesn't work with WinForms designer (but it works well with Blend and WPF).
Language given developer education - It is more difficult to hire F# programmers than to hire C# programmers. If you're creating some application that doesn't have any complicated core (e.g usual "interface for a database") then developing it in C# will be cheaper (If you could hire good F# developers they would likely finish it faster and with less bugs, but it may not be worth the cost).
Language given libraries available - If you want to restrict yourself to using F# with just libraries that work well with it then the domain shrink a bit more. For example, LINQ to SQL and ASP.NET MVC can be used with F#, but it isn't perfect. However, for many projects it would make sense to develop your own libraries and then F# becomes great language for that.
好问题。我想说,开发人员、经理和客户方面的语言原因为零,但有许多不幸的技能、能力和态度原因。
Good question. I'd say that there are zero language reasons and many unfortunate skill-set, aptitude, and attitude reasons on the part of developers, managers, and customers.
您可能需要三思而后行,将其用于操作系统内核开发或低级嵌入式系统:-)
You might want to think twice about using it for operating system kernel development or low-level embedded systems :-)
许多 Microsoft 的 UI 技术(例如 WPF)都对数据绑定提供出色的支持。当用户与 UI 交互时,有效的数据绑定使用双向绑定来更新底层对象。这意味着有效的数据绑定需要可变对象。
F#强调不可变类型,与该类型的数据绑定模型非常不匹配。虽然可以在 F# 中创建可变类型,但这样做会消除该语言的许多优势。使用可变性更自然的语言(例如 C#)更有意义。
Many of Microsoft's UI technologies such as WPF have excellent support for databinding. Effective databinding uses two-way binding to update the underlying objects when the user interacts with the UI. This implies that effective databinding requires mutable objects.
F#, with its emphasis on immutable types, is a pretty poor match to that type of databinding model. While it's possible to create mutable types in F#, doing so would remove a lot of the benefits from the language. It simply makes better sense to use a language (such as C#) where mutability comes more natural.
如果您愿意放弃 C# 特有的工具,并支付任何适用的采用成本,那么在任何特定领域,F# 的能力都不会低于 C#。
If you're willing to give up tools particular to C#, and pay whatever cost of adoption is applicable, there is no particular area where F# would not be at least as capable as C#.
好吧,冒着声明显而易见的风险,F# 首先也是最重要的是一种函数式编程语言,而 F# 中的 OOP 编程可能会让人头疼。因此,如果您正在处理最适合用 OOP 表达的问题,我想使用 C# 确实更有意义。
相互递归类型和接口的显式实现是我想到的第一个例子,说明为什么 F# 中的 OOP 可能很麻烦。
“用 OOP 最好地表达问题”的一个(经常被引用的)示例是创建 UI 库。你有很多小部件,它们封装了自己的状态,你想要求它们做一些事情,比如多态地“画你自己”(这是一个词吗?)
Well, at the risk of stating the obvious, F# is first and foremost a functional programming language and OOP programming in F# can be a pain in the neck. So if you're working with a problem that is best expressed with OOP I imagine using C# does make more sense.
Mutually recursive types and explicit implementation of interfaces are the first examples off the top of my head of why OOP in F# can be cumbersome.
An (often cited) example of "problem that is best expressed with OOP" is creating a UI library. You have many widgets, which encapsulate their own state and you want to ask them to do a few things like "draw yourself" polymorphically (is that even a word?)
Web 应用程序中的框架(例如 ASP.NET MVC)更适合 C#。 “绝对没有意义”是一个极端,我会说“正常情况下”。
当然,它可以用于 Web 应用程序引用的库,但不能用于实际应用程序本身。
Web Applications where Frameworks e.g. ASP.NET MVC lend themselves better to C#. "Absolutely no sense" is an extreme, I would say "under normal circumstances."
Of course it could be used for libraries that the web application referenced, but not the actual application itself.
在 Visual Studio(ASP.NET、WebForms、WPF 等)和第三方工具完全支持 f# 之前,f# 将始终是二等公民。
让我们面对现实吧,与可靠的库(.NET,可用于 c# 和 f# - 这里两者都没有优势)、IDE(智能感知、语法着色等)相比,语言选择通常对生产力没有太大影响, (据我所知,仅部分支持 f#...例如不支持 Razor)和第三方工具(例如 resharper)。
因此,考虑到这一点,我认为在所有这些工具都适用于 f# 之前,没有人可以建议完全替代 c#。一个好的折衷方案是在类库中使用 f#,并在前端继续使用 c#。
Until f# is fully supported by Visual Studio (ASP.NET, WebForms, WPF, etc) and third party tools, f# will always be a second class citizen.
Let's face it, language choice usually doesn't make much difference to productivity when compared to a solid library (.NET, available to both c# and f# - no advantage to either here), the IDE (intellisense, syntax coloring, etc), (only partially support available to f# as far as I know... e.g. no Razor support), and third party tools (e.g. resharper).
So with that in mind, I don't think anyone can recommend a complete replacement of c# until all of those tools are in place for f#. A good compromise is to use f# in class libraries and continue to use c# on the front end.