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

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


当前回答

在PHP中,你可以这样做:

System.out.print("hello");

其他回答

我所知道的最大的体面和奇怪的编程语言集合(今天是1313),你可以在这里找到: http://99-bottles-of-beer.net/ 准备好看到真正奇怪的东西;-) 每个人都应该做出自己的选择

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

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

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

我一直在想为什么最简单的程序是:

class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

然而它可以是:

print "Hello World!"

也许这是为了吓唬计算机科学专业的学生……

Perl的许多内置变量:

$# — not a comment! $0, $$, and $? — just like the shell variables by the same name $ˋ, $&, and $' — weird matching variables $" and $, — weird variables for list- and output-field-separators $! — like errno as a number but strerror(errno) as a string $_ — the stealth variable, always used and never seen $#_ — index number of the last subroutine argument... maybe @_ — the (non)names of the current function... maybe $@ — the last-raised exception %:: — the symbol table $:, $^, $~, $-, and $= — something to do with output formats $. and $% — input line number, output page number $/ and $\ — input and output record separators $| — output buffering controller $[ — change your array base from 0-based to 1-based to 42-based: WHEEE! $} — nothing at all, oddly enough! $<, $>, $(, $) — real and effective UIDs and GIDs @ISA — names of current package’s direct superclasses $^T — script start-up time in epoch seconds $^O — current operating system name $^V — what version of Perl this is

还有很多这样的东西。点击这里阅读完整列表。

在ColdFusion中,文本值自动转换为各种数据类型,用于各种目的。我遇到了一个奇怪的问题,“00A”和“000”被返回为相等。事实证明,ColdFusion将“00A”解释为时间,转换为某种数字时间格式,并将其转换为0。“000”被转换为0。所以它们都被认为是相等的。那时我学习了字符串的比较函数。