在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
当前回答
在Common Lisp中,零维数组是很奇怪的,而且很自然地,它们具有读取语法。
? (aref #0A5)
5
其他回答
我不敢说XML是一种编程语言,但它不是贴近我们的内心吗?: -)
在我看来,XML中最奇怪的特性是以下是一个格式良好的文档:
<_....>
</_....>
下面是允许连续点的NT-Name的词法定义。
另一个C-ism。
int i= 0;
while( i != 12 ) {
/* Some comment
i += 1;
/* Another comment */
}
为什么不行?棉绒会告诉你。然而,C编译器通常会轻松地忽略这一点。我也是。
当我发现问题出在哪里的时候,那真是太棒了。
在Common Lisp中,零维数组是很奇怪的,而且很自然地,它们具有读取语法。
? (aref #0A5)
5
通知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.
像图灵机模拟器这样的其他愚蠢的东西可以找到。
Python的everything-is-really-a-reference有一个有趣的副作用:
>>> a = [[1]] * 7
>>> a
[[1], [1], [1], [1], [1], [1], [1]]
>>> a[0][0] = 2
>>> a
[[2], [2], [2], [2], [2], [2], [2]]