最近写了不少javascript,对原型语言有了浓厚的兴趣。听闻原型语言中有一清丽脱俗,小桥简单的语言,叫Io,随即花了点时间研究下。
不看不知道,一看吓一跳。Io这门语言没有关键字,万事万物皆为消息,程序员要做的无非是把消息串联起来,传递,处理。
根据 维基百科) 的定义,IO语言主要吸取了这些语言的如下特点:
看了berkeley网站上的文章Who Says C is Simple?,顿感汗流浃背。如果招聘官按照这个题目去面试,我也就将将五十分。不过话说回来,这里所列的case都太偏门,走的是圣火令的武功路数,真正做工程的这么写代码就是欠揍。
但是抱着学语言的态度,这里的题目如果你不懂都值得深究。我研究了下第四题 —— 这是让我比较困惑的一题。
// Functions and function pointers are implicitly converted to each other.
int (*pf)(void);
int f(void) {
pf = &f; // This looks ok
pf = ***f; // Dereference a function?
pf(); // Invoke a function pointer?
(****pf)(); // Looks strange but Ok
(***************f)(); // Also Ok
}
If somebody says X language is better than Y language, usually there will be a fierce quarrel between two sides. If you're using certain language for a long time, you will be the evangelist of that language, and try to protect it unconsciously. Admitted or not, you have been trapped in a tunnel, that what you can see is constraint greatly. "The Shawshank Redemption" gives a good footnote on it:
[Red] These walls are funny. First you hate 'em, then you get used to 'em. Enough time passes, you get so you depend on them. That's institutionalized.
So before we're institutionalized too deep, let's learn something completely different - a language that not derived from C family, a language that leads you to a totally different mindset.
Erlang seems to be a good candidate.