在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?

请每个回答只回答一个特征。


当前回答

X = X + 1

当我还是初学者的时候,这很难消化,而现在函数式语言不使用它了,这就更难了!

如果你不明白这有多奇怪:把等号看作断言语句,而不是赋值操作,就像你在基础代数中经常做的那样,那么这相当于说“0 = 1”。

其他回答

Algol通过名称传递(使用C语法说明):

int a[3] = { 1, 2, 3 };
int i = 1;

void f(int j)
{
    int k;
    k = j;  // k = 2
    i = 0;
    k = j;  // k = 1 (!?!)    
}

int main()
{
    f(a[i]);
}

在C:

int main() {
  int i = 0;
  int array[] = {1,2};

  return (i[array] + 1 == array[i]);
}

这个程序将返回1 (true)。

任何东西都会自动将任何类名和成员名复数或单数。

例如,Linq-to-Sql

通知7。一个有效程序的例子:

    Chomsky is a room. 
    A thought is a kind of thing. 
    Color is a kind of value. 
    The colors are red, green and blue. 
    A thought has a color. It is usually Green. 
    A thought can be colorful or colorless. It is usually colorless. 
    An idea is a thought in Chomsky with description "Colorless green ideas sleep furiously." 
    A manner is a kind of thing. 
    Furiously is a manner. 
    Sleeping relates one thought to one manner. 
    The verb to sleep (he sleeps, they sleep, he slept, it is slept, he is sleeping) implies the sleeping relation. 
    Colorless green ideas sleep furiously. 

像图灵机模拟器这样的其他愚蠢的东西可以找到。

Java中有标记的break和continue语句。

它们允许你通过一次突破突破多个控制块。