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

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


当前回答

我不知道这是否是真的,但我们偶然发现VS FORTRAN(66或77)不支持递归。递归是偶然的,我们的默认F77支持它很漂亮,但当我们把源代码IBM - Whatta混乱。

其他回答

让我们为所有试图废除保留词的语言(如PL/I)投票。

还有什么地方可以合法地写出这样有趣的表达:

IF IF THEN THEN = ELSE ELSE ELSE = THEN

(IF, THEN, ELSE是变量名)

or

IF IF THEN THEN ELSE ELSE

(IF为变量,THEN和ELSE为子程序)

回想起来,FORTRAN的计算goto是相当奇怪的。维基百科告诉我一些基础知识胜过它。

另一个著名的最爱是Algol 60的名称参数调用传递。

在Java中,字符串如何处理==操作符取决于它是如何构造的,这存在一些不一致性。

String a = "Hello";
String b = "Hello";
System.out.println(a == b ); // prints true.
String c = new String("Hello");
String d = new String("Hello"); 
System.out.println(c == d ); // prints false

很久以前,我曾经用BUT子句构建过一种语言。

A very tiny thing that annoyed me in COBOL was that there was no dedicated modulo operation. Instead you could do a division specifying that you only wanted whole number results and store the rest in a different variable. Since COBOL is very sensitive when it comes to variables that means that you ended up with a variable you didn't really need, i.e. the actual result of the division. This is the story of how I once named a variable "USELESS" - that was the most appropriate name I could think of.