我正在阅读一篇描述Ruby的文本,它说:
Ruby is considered a “reflective” language because it’s possible for a Ruby program to analyze itself (in terms of its make-up), make adjustments to the way it works, and even overwrite its own code with other code.
我对“反射”这个术语感到困惑 - 这主要是指Ruby如何查看一个变量并确定它是整数还是字符串(鸭子类型),例如:
x = 3
x = "three" # Ruby reassigns x to a String type