In episode 2 (00:22:15) you mention a “good use” of @class « self@ to quickly implement getter and setter of an instance variable @@count@. I get a bit confused with this example. Shouldn’t @@count@ be a class variable (@@@count@), as it reflects the state of class Dave (that is: how many instances of class Dave are instanciated)?
I have checked with a simple:
def get_count @count end
… that @@count@ is indeed not accessible to instances of Dave (@get_count@ method called on those instances would return @nil@), so @@count@ does behave like a class variable (I understand it’s because it’s defined right after @class Dave@, at a point in code where the current object is the class Dave object).
But still, why do class variables (@@@count@) exist in Ruby then, and how would a @@@count@ variable compare to @@count@ ?
Anyway, a thousand thanks for this enlightening serie!