mop problem 1 - mop can't have protected attribute variable
mop can't have protected attribute variable. All attribute variable is private in the class.
use mop;class Point {
has $x; # private attribute variable
has $y; # private attribute variable
}class Point3D extends Point {
method foo {
# We can't access $x and $y.
}
}
If object is hash based object, this is resolved by the following way.
class Point { method init { $self->{_x} = 3; } }
class Point3D extends Point {
method foo {
my $x = $self->{_x};
}
}
hash based object can communicate super class and sub class.
but mop is inside-out object. this is impossible.
mop only allow private access via attribute variable or public access via accessor method.
this is not useful.
That's what accessors are for.
I don't think this is good design. accessor should be created for public interface. If we use the attribute variable only from sub class, I don't create accessor.
I agree that accessors should only be created for the public interface. I think perhaps where we differ is that I think subclasses should only use their parent's public interface!
>I think subclasses should only use their parent's public interface!
I think that is not sophisticated design. We suffer performance damage in subclass if we can't access attribute variable directory.
Sub class is usually created as similar class of super class. I want to use sub class as same usage as super class.
I think inside-out object is bad design. I think it is good that object data is saved to hash reference and meta data is saved to outside.