Erlang The Next Java?
从 maillist 得知 GoF 的 Ralph Johnson 最近对 Erlang 给出一些评价。原文在【这里】。
应该说,这是一个大师对 Erlang 相当高的评价,当然,不能排除 Ralph 大师本人对 Lisp/Prolog 系的偏爱,或与 Joe Armstrong 私交甚笃的因素。大师煽情的写下了:
Erlang is going to be a very important language. It could be the next Java. Its main problem is that there is no big company behind it. Instead, it is being pushed as an open source project. Its main advantage is that it is perfectly suited for the multi-core, web services future. In fact, it is the ONLY mature, rock-solid language that is suitable for writing highly scalable systems to run on multicore machines.
而作为 OO 领域,设计模式的大师,关于 Erlang 和 OO 有这么一段精彩的表达:
Processes in Erlang are objects. At the beginning of my course on OO design, I explain three views of OO programming. The Scandinavian view is that an OO system is one whose creators realize that programming is modeling. The mystical view is that an OO system is one that is built out of objects that communicate by sending messages to each other, and computation is the messages flying from object to object. The software engineering view is that an OO system is one that supports data abstraction, polymorphism by late-binding of function calls, and inheritance.
Erlang is a perfect example of the actor model, which is an example of the mystical view. Processes certainly support data abstraction and polymorphism. An Erlang process is a function that reads from the incoming message queue, pattern matches to find a particular message, and then responds to it. A function structured in this particular way is similar to a class in Smalltalk. Moreover, given several kinds of processes that have a common protocol and that share some things in common, it is easy to factor out the commonality into a function that they can both call. This is similar to class inheritance. So, you could even say that Erlang supports inheritance, though it does it very differently than in Java or Smalltalk. I imagine that many Erlang programmers think about programming as modeling. So, Erlang fits all the characteristics of an OO system, even though sequential Erlang is a functional language, not an OO language.
和其他语言相比,大师认为 Erlang 的特别之处在于:
Joe makes too much of functional programming because he says that lack of mutable state implies no locks. However, it is really lack of SHARED state that implies no locks. You could write processes in Basic, perl, or C. I’m sure that lots of people will look at Erlang and say “we can add that to our language”. In my opinion, it is the concurrent programming aspects of Erlang that make it special, along with its mature implementation and powerful library designed for concurrency and reliability.
I do not believe that other languages can catch up with Erlang anytime soon. It will be easy for them to add language features to be like Erlang. It will take a long time for them to build such a high-quality VM and the mature libraries for concurrency and reliability. So, Erlang is poised for success. If you want to build a multicore application in the next few years, you should look at Erlang.
我这么理解这篇充满溢美之词的文章—— Erlang 是一种强大的语言,但是不是会成为下一个 Java ,恐怕大师一个人说了还不算。也许这更象是一场博弈,正如大师开头就提到的——Its main problem is that there is no big company behind it ——想一想,如果离开了 SUN ,今天的 Java 会是怎样?
anyway, impossible is nothing. 且让我们拭目以待。


Comments
Ericsson不算big company?
其实java的主要是靠ibm的说。
另一个Java。。。某天,大学生们发过来的简历都是:精通Erlang,精通ErlangEE,多可怕丫。。。:)
看了erlang的smp实现 其实和ace之类的差不多 细节作的好一些 没有想像中的那么牛的 不要被误导了 要理智。
@yufeng 没到失去理智的地步啦,:D
smp 语境下,需要怎样的编程语言?我的需求,其实很简单:
1,有效利用多核运算能力
2,有 gc 的高级的程序设计语言
如果 java 有这样的特性,我会很乐意用它(但,mutable语言难以解决锁的问题,难以达到第一条)。
ace 之类的,论效率,确实无出其右,erlang 也是用 c 实现的,能比 ace 好到哪里去?但效率是一回事,用它来编程又是一回事。如果让我在 ace 上编程?用 java 还好,如果用 c 我可没信心——正漏,侧漏,后漏——叫人好不安心(不过 java ace 效能如何,也是个问号)。这个问题其实因人而异——对我来说,泄露对我很致命,没有 gc 绝对不用。但对 yufeng 同学来说,就根本不是个问题,所以,相同的问题,看法不一致,其实很正常。
不至于吧,正漏侧漏后漏都出来了,C/C++或者jackyz至于有这么不堪么
哈哈。广告看多了,也夸张一下下嘛。不过,经历过两次无比痛苦的 c 泄露 debug 之后,确实觉得有阴影,倒是真的。
资源的掌控本来就是程序员的本分,即使系统或者VM帮你做了什么,也是亡羊补牢性质的
@pi1ot 同意“资源掌控是程序员的本分”这样的说法。语言或者 VM 能做的是有限的,以 GC 著称的 Java 同样也有泄露。在这层意思上,大家没有分歧。
比如说,我用 Java 写出有泄露的程序,这当然是我的问题——“我没有尽好程序员的本分”,这毫无疑问。你要因此鄙视我的话,那我是应该被鄙视的。
但,程序员的职责是一回事,语言本身的特性是有区别的,这是另外一回事。恕我愚钝,在这两者之间,我没看出“选择语言”和“逃避职责”之间有什么逻辑上的必然。
关于后者,写出同一个没有泄露的程序,用 Java 写和用 C 写,对程序员来说,在细致程度的要求显然是不同的(一个是大部分都不用管,一个是一点不管都不行),我想,这个我们应该没有什么好分辨的了吧。
当这两个选项同时摆在面前的时候,对不住,我是会选择容许我不用那么小心翼翼的来编码的语言,让自己的生活轻松一点。如果你因为这个,而鄙视我,那我就只好耸耸肩,说“人各有志,不可强求”了,你说呢?
鄙视?…有这么严重么…没有吧
jackyz 反应这么大,是不是也被今天的单双号限行给郁闷了
@_@ 明明是刚发的,一刷新就又有了,回帖速度真是超级迅猛啊。
呃,单双号的问题,咱们私下聊。怎么能破坏和谐美好的伟大局面呢,啊。哈哈。。。
平心而论 erlang还是非常好用的。 你不用费那么大劲就可以做出一个c/c++费时费力,相同效力的东西, 开发效率高很多. 而且otp库里面带了很多支撑系统 如snmp, release handle这些是目前大部份c/c++库说没有的, 而这些东西又是实际运行中间需要的特性。
Write a Comment