The set of local variables, which is in scope at any given point in the program, is defined lexically and, thus, can be determined statically, even when the analysis time. Thus, Ruby even knows, before runtime, which local variables are in scope, and thus can distinguish between the send message and the local difference of variables.
Constants are viewed first lexically, but then through inheritance, i.e. dynamically. It is not known which constants are in the region before execution. Therefore, in order to eliminate ambiguity, Ruby always assumes a constant, if this is clearly not the case, that is, it accepts arguments or has a receiver or both.
source share