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

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


当前回答

我喜欢这类东西在JavaScript中很好的事实:

var futureDate = new Date(2010,77,154);
alert(futureDate);

结果是距离2010年第0个月的第0天77个月零154天,即2016年11月1日

其他回答

我最喜欢的c++语法小技巧是,你可以把URL(有一些限制)直接放到代码中:

int main( int argc, char *argv[] )
{
    int i=10;

    http://www.stackoverflow.com
    return 1;
}

这可以很好地编译。

语法高亮有点破坏了这个笑话,但它仍然很有趣。

这缺少了一个奇怪的特性:Python没有switch语句(尽管存在变通方法)。

在Python中:

i = 1
++i
print i

输出“1”。行'++i'的计算结果为+(+i) (Python不支持增量操作符)

Oracle有几个SQL WTF问题。

Oracle将空字符串处理为null。 在“<>”比较中处理空值。 创建表WTF(键数为主键,动物varchar2(10)); 插入WTF值(1,'dog'); Insert into WTF values (2, "); Insert into WTF values (3,'cat'); Select * from WTF where animal <> 'cat';

唯一返回的行是(1,'dog')行。

很简单,Erlang有很多。例如,标点符号的三种形式,

a_function(SomeVariable) ->
  statements_end_with_commas(),
  case PatternMatching of
    0 -> now_we_end_with_semicolon;
    true -> except_the_last_one
  end.

%%  Function definitions end with periods!