Hi,
> Some points:
> - singleton classes don't have their own class variables, but they
> can have their own constants
> - constant and class var lookup use the lexical scope, so it
> depends "where" you do something (that's why bar's C and baz's C
> are different)
> - (lexical) singleton-class-scopes are skipped when accessing class
> vars (that's why [*] changes B's @@var and not A's @@var)
>
> I hope that helps and doesn't totally confuse you ;-)
OK. One hour later, this is became clear...
I'd write the points above in a different order:
- singleton classes can have their own constants
- singleton classes don't have their own class variables. (Lexical)
singleton-class-scopes are skipped when accessing class vars
- constant and class variable lookup use the lexical scope, so it
depends "where" you do something
Now... I do have a question. On one hand, I really, really want to
know all these fine details. That's just my nature.
However, in this case, I must ask: is this going to be *useful* at
any point in time?
When would you want to set a constant for a singleton class?
The rest makes perfect sense to me: a singleton class could
realistically need access a class variable. And I realise that I need
to know that constant and class variable lookup use the lexical
scope. But... singleton constants...?
Just curious!
Merc.