出于好奇,我正在寻找一种动态的面向对象语言,它允许您将 true 更改为 false,反之亦然。
像这样:
true = false, false = true;
这也会影响任何条件语句,因此 42 == 42
应该返回 False。
基本上,在这个前提下,语言中的任何内容对程序员来说都是安全的。
有这样的语言吗?
最佳答案
Smalltalk 会让你这样做。
Everything in Smalltalk-80 is available for modification from within a running program. This means that, for example, the IDE can be changed in a running system without restarting it. In some implementations, the syntax of the language or the garbage collection implementation can also be changed on the fly. Even the statement true become: false is valid in Smalltalk, although executing it is not recommended. When used judiciously, this level of flexibility allows for one of the shortest required times for new code to enter a production system.
关于programming-languages - 寻找允许您更改真假的编程语言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2464468/