0

我已经使用面向对象的语言开发超过 10 年了(包括 C# 和 java)。但我越来越多地听到很多人谈论函数式编程语言:Ruby、Scala、Haskell,......

虽然我已经阅读了很多关于这些编程语言的内容。不幸的是,大多数教程大部分时间都在讨论语法。但是我还没有找到任何解释领域的教程或任何给出这些语言典型实际应用的教程。

我被很多问题困住了,下面是我脑海中出现的一些简单问题的简短列表。

它们是独立的语言吗?

  • 是要在另一种编程语言中使用的功能语言。与 Java/C# 相同的方式使用其他语言,例如 SQL、Regex、HQL、XQL、...?
  • 如果单独使用,他们是否使用编译器?

他们的框架有多强大?

  • 是否支持图形组件,例如窗口或对话框?
  • 是否支持多线程?
  • 是否支持套接字交互、网络服务?

摘要:有人可以快速回答我提到的问题,或者甚至更好,您能否提供一些带有实际示例的教程链接?

先感谢您。

编辑:简化/删除了一些问题

4

1 回答 1

14

Are functional languages to be called from within another programming languages. The same way as Java/C# use other languages such as SQL, Regex, HQL, XQL, ... ?

They can be, but needn't be limited to such a convention.

Can a functional language use a framework like the java framework or .net framework ? If so, do these frameworks use graphical components such as windows or dialogs ?

Yes - F# is a good example here.

Can a functional language only be used for console applications and websites that simply echo output to some kind of stream ?

No.

Can a functional language be used standalone. If so, do they use compilers ?

Yes, they can be standalone. Yes, they can use a compiler - these are just languages - the manner of execution is entirely up to the implementer. There are interpreters and compilers for many functional languages.

I use java for multithreaded client-server applications with a front-end that acts as a desktop application (thick client). Could I replace all my java code by code written in a functional language?

You can write mutlithreaded programs in functional languages, you can write desktop applications, and you can implement any arbitrary algorithm in one of these languages just like you have in Java. Are you trying to ask something more particular with this question?

Are functional languages a subcategory of the procedural languages ?

No.

Is it just a matter of syntax or is there more to it ?

More to it. I'd say that a functional language is one that encourages you to program in a functional style. This is far-afield of the focus of Stack Overflow. I suggest you see pre-existing material on the subject, such as the Haskell wiki.

于 2013-09-08T20:43:53.173 回答