I would be interested to understand more about Tye's concerns and how valid they are.
The focus of Tye's concerns is the fact that the ego() function uses its caller to decide which alter ego to produce. Here, "caller" means the package that was in force when the call to ego() was compiled. Now, it is possible to do things like
package Foo;
sub Bar::method { my $ego = ego($_[0]); ... }
That would indeed produce an anomaly: A method in class Bar that accesses the ego belonging to Foo. On the other hand, that would be the described behavior, for better or worse. It isn't something that easily happens by accident while you're writing your accessors. It may even be useful in some situations, I haven't thought about it much. In general, the Alter-approach assumes that methods are compiled in the class their name resides in.
Tye has another objection which I'm not sure I understand. If I understand it right it is about qualified method calls, in the form
$obj->Class::method(...);
but I think an Alter-based class would behave exactly as it should with these.
Anno | [reply] [Watch: Dir/Any] [d/l] [select] |
| [reply] [Watch: Dir/Any] |
| [reply] [Watch: Dir/Any] |