Closed yuki-kimoto closed 11 years ago
We already have an alternative:
has $!foo is weak_ref;
No, "has $!foo is weak_ref;" is for class author. How can class user weak attribute?
That would be a violation of encapsulation and would not be recommended.
But we should allow class user to weaken attribute? Is it bad not to provide the alternative way?
That would be a violation of encapsulation and would not be recommended.
I understand it is not good, but not providing the alternative way is more bad?
For example, There are Class P and Class Q. User is not author of these classes.
my $p = P->new;
my $q = Q->new;
$p->q($q);
$q->p($p);
This is cross-reference. In mop, Is there what way to resolve this case?
If you're going to be doing something like that, the classes involved absolutely need to know about it (and probably manage it themselves). That said, the traits are all implemented using public APIs, so there is a way to do it, but again, you really, really shouldn't.
My Question is that dose mop provide alternative way. If mop don't provide it, one thing become impossible.
I understand your opinion "you really should't". but above is real problem which can occur in Perl5.
In Perl5 design, is it good that programmer have restriction?
This topic had been closed. I want to reopen this.
I need alternative in mop.