| ☞ | Program
Repair Shop ![]() |
32 |
Overall, I think my decision to put observer lists into the objects is a good one
In many ways, it simplifies the code
It certainly clears up a bunch of nasty and otherwise insoluble bugs
But in some ways it complicates things
For example, Class::Observable allows:
Alarm->add_observer($guard);
$alarm = Alarm->new();
$alarm->notify_observers(...); # Notifies $guard
Where to store the observers for class Alarm?
Answer: In a package variable in the class
But object member data and package variables are accessed differently
This was not a problem when it all went into %O
| ☞ | ![]() |
☞ |