That depends on what version of Pharo you use. In Pharo 1.4 you can use SystemChangeNotifier to do something like this:
SystemChangeNotifier uniqueInstance notify: toSomeObject ofSystemChangesOfItem: #class change: #Added using: #someMethod:. then if a new class is added to the system, SystemChangeNotifier will call #someMethod: on toSomeObject, passing an Event to #someMethod:. You can browse the code on SystemChangeNotifier to see all the notification you can use, and the package "System-Change Notification" to see the events you can receive. In Pharo 2.0 you can do the same thing using SystemAnnouncer: SystemAnnouncer uniqueInstance on: ClassAdded send: #someMethod: to: toSomeObject. You can see the different announcements you can use on browsing the package "System-announcements". In this example #someMethod: will receive an announcement. -- Daniel Galdames El domingo, 14 de octubre de 2012 a las 20:14, Miguel Enrique Campusano Araya escribió: > I want to do some logic when there is a change on the system, like when a new > class is loaded or when a method change. I don't want to put this logic > explicit on the methods of the system who do that. I would like to know if i > could subscribe to those special events (method change, new method, changes > on a class and so on) so I can do what I want outside those methods. > I heard about the Announcements but I don't know if Announcements could help > with this problem. > > Can anyone give me some highlights to do those things? > > Thanks! > (I'm really trying with my english, hope it's understandable) > > > -- > Miguel Enrique Campusano Araya > Estudiante de Ingeniería Civil en Computación > Universidad de Chile >
