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

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


当前回答

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

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

其他回答

在JavaScript中,2.0 - 1.1 = 0.8999999999999999。这是规范中实现浮点数的结果,所以它总是这样的。

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

打印Piet的程序

通知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. 

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

VBScript的日期/时间文字(为什么这个仍然如此罕见?):

mydate = #1/2/2010 5:23 PM#

If mydate > #1/1/2010 17:00# Then ' ...

编辑:日期文字是相对的(那么它们在技术上是文字吗?):

mydate = #Jan 3# ' Jan 3 of the current year

VB。NET,因为它是编译的,所以不支持相对日期文字。只支持日期或时间字面量,但缺失的时间或日期被假定为零。

编辑[2]:当然,有一些奇怪的极端情况会出现相对日期……

mydate = #Feb 29# ' executed on 2010-01-05, yields 2/1/2029

在PHP中,字符串和函数指针一样好:

$x = "foo";
function foo(){ echo "wtf"; }
$x(); # "wtf"

不幸的是,这并不管用:

"foo"();