Consider the following code using class instance variables:
@total_count = n
self.class.total_count = 0
The compile requires "self.class.total_count" as the more readable "class.total_count" is mistaken by the parser as a faulty class definition.
How about adding a class method to Object?
It would allow the use of "__class__" as a de facto prefix for class instance variables and would fit e.g. the id/__id__ and send/__send__ paradigm.
#2 Updated by Marc-Andre Lafortune over 5 years ago
a) class is more keystrokes (if you count the shift key)
b) self.class is clear (and exists currently)
c) I feel that something should ideally be reserved for special cases; self.class isn't. I am aware that FILE was used a lot before and there's talk about dir, but I think that require_relative is now a better solution for most of these cases.