mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
restores original intention in constants guide, reworded [ci skip]
Once all technicalities have been introduced, the purpose of this paragraph is to precisely unroll expressions like "the String class". That way, the reader is forced to clearly separate concepts that Ruby programmers often have kind of blurred: * Constants are storage, like variables. * Ruby does not have syntax for class or module names. * `String` is a regular constant that holds a value. In this case, the value happens to be a class object. * Constants are stored in class and module objects. In the case of `String`, the holder is the class object stored in the `Object` constant. Understanding that paragraph the way is written is important to accomplish this objective. References #32818.
This commit is contained in:
parent
5edafc21b9
commit
5c7656d9a5
1 changed files with 6 additions and 4 deletions
|
@ -230,10 +230,12 @@ is not entirely equivalent to the one of the body of the definitions using the
|
||||||
`class` and `module` keywords. But both idioms result in the same constant
|
`class` and `module` keywords. But both idioms result in the same constant
|
||||||
assignment.
|
assignment.
|
||||||
|
|
||||||
Thus, when one informally says "the `String` class", that really means: the
|
Thus, an informal expression like "the `String` class" technically means the
|
||||||
class object stored in the constant called "String" and this "String" constant
|
class object stored in the constant called "String". That constant, in turn,
|
||||||
gets stored in `Object` class. `String` is otherwise an ordinary Ruby constant
|
belongs to the class object stored in the constant called "Object".
|
||||||
and everything related to constants such as resolution algorithms applies to it.
|
|
||||||
|
`String` is an ordinary constant, and everything related to them such as
|
||||||
|
resolution algorithms applies to it.
|
||||||
|
|
||||||
Likewise, in the controller
|
Likewise, in the controller
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue