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

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


当前回答

在ruby/python/c中,你可以像这样连接字符串:

a = "foo" "bar"
print a # => "foobar"

其他回答

在我看来,在c#中能够将超出范围的整数转换为枚举是非常奇怪的。想象一下这个枚举:

enum Colour
{
    Red = 1,
    Green = 2,
    Blue = 3
}

现在,如果你写:

Colour eco;
eco = (Colour)17;

编译器认为这很好。还有运行时。

请看这里了解更多细节。

“Piet是David Morgan-Mar设计的一种深奥的编程语言,他的程序是位图,看起来像抽象艺术。”

打印Piet的程序

我很惊讶没有人提到大多数类c语言中丑陋的开关case实现

switch (someInt) {
    case 1:
    case 2: System.out.println("Forgot a break, idiot!");
    case 3: System.out.println("Now you're doing the wrong thing and maybe need hours to find the missing break muahahahaha");
            break;
    default: System.out.println("This should never happen -,-");        
}

好在新语言正确地实现了它。

在C。

int;

(&a)[0] = 10;/*将值10赋给*/

[0]等于*(&a +0)得到*(&a)也就是a。

Delphi不关心像“word”这样的类型转换,将读取数组arr[0..65535] where pos = 65535: Arr[单词(pos + 10)]