在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
当前回答
在MAXScript中,所有操作符都是平等对待的。因此,a = b +c使a等于b,然后计算a+c的和,并丢弃结果。
其他回答
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.
命名空间解析顺序
为例。
namespace foo.bar.xyz{
public class Foo{
Exception e; // you'll get compile time error here....
}
}
因为
namespace foo.bar.Exception{
class HowDoMyWayException : ApplicationException {
// because someone did this
}
}
在流行性腮腺炎中,你可以有一个带偏移的GOTO。如果你有(我的腮腺炎已经生锈了…)
some_label if x=1 do_something
else do_something_else
然后是代码
goto some_label+1
将跳转到ELSE语句…
在Common Lisp中,零维数组是很奇怪的,而且很自然地,它们具有读取语法。
? (aref #0A5)
5
下面的c#代码抛出NullReferenceException而不是打印1:
static void SomeMethod(string format, params object[] args)
{
Console.WriteLine(args.Length);
}
static void Main(string[] args)
{
SomeMethod("blabla", null, "Ok here"); // print 2
SomeMethod("blabla", null); // exception
}