On Oct 13, 2005, at 4:45 PM, TSa wrote:
No, not that class has no state, but that with the currently specced classes we have inherited behaviors (class methods) but they do not inherit the accompanying state (class attributes) as well. I see this as potentially very problematic.


What do you mean with "not inheriting class state"? I would think that
beeing an instance of a class, an object should have access to the shared
class data, but it is not part of the per object state. Or do you mean
that class data is not accessable to the instances at all? I would hope that this is 'hidden' in the scopes where the class's parts are defined
but of course accessable lexically from class support code there.

I mean that classes do not inherit class state along subclass lines. Take this code for instance:

  class Foo {
      has $.bar;
  }

every instance of Foo I create has it's own copy of $.bar. Now I subclass it:

  class Bar is Foo {}

every instance of Bar has it's own copy of $.bar as well. Now look at this from the class attribute perspective.

  class Foo {
      our $.baz; # class data here,.. not instance data
  }

Foo has a single copy of $.baz in it's internal namespace. Now subclass it:

  class Bar is Foo {}

Bar does not have it own copy of $.baz, in fact Bar's ability to access Foo::{$.baz} (or however it would be spelt) is not more special than any other class in the system.

The point I am trying to make is that class data is unique to the class itself, and subclasses of said class do not have any special priviledges or access to that data (leaving auto-generated accessors out of the picture for now).

This is different though from how class methods behave, which seems to me to be problematic.

Stevan

Reply via email to