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

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


当前回答

Tcl在解释器中虚拟化的时间钩子非常奇怪: http://www.tcl.tk/cgi-bin/tct/tip/233.html

基本上,它允许你让解释器使用一些其他的时间数据源,例如,先在模拟器中运行硬件测试,然后替换计时器函数,对真实的东西运行相同的测试。

其他回答

大约20年前,我用一个编译器为一种叫做Coral的语言工作,它允许我声明只写变量!

不过,这是有道理的,因为它们是全球性的,被用作一种信号机制。一个进程写入值,另一个进程读取值。

来自边远吗?

在找函数吗?为什么不是一门语言呢?

我喜欢PHP,但它总是这样构建:“哦,糟了!我忘了这个!让我们在函数"中添加另一个参数,结果如下:

Str_replace ($search, $replace, $subject…) Strstr ($subject, $search,…)

注意额外的下划线和参数的不同顺序。

这里还有一些东西

$a = array( 'a', 'b', 'c', 'd');

print_r($a); //Prints array( 0 => 'a', 1 => 'b',    2 => 'c', 3 => 'd');
unset($a[2]); //Destroys the element 2 of the list
print_r($a); //Prints array( 0 => 'a', 1 => 'b',    3 => 'd');

我最喜欢的c++之一:

#include <iostream>
using namespace std;
int main()
{
    cout <<  3 << 5  << endl;
    cout << (3 << 5) << endl;
    return 0;
}

当然,这很容易解释,但它让刚开始编程的学生摸不着头脑!

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.