Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2021/imperative-programming-resit/8/c/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2021 Imperative programming (resit) 8 c Solution by
Codex 0 2026-10-25
A widget or model implementing
Publisher is the subject. It calls publish(event) when an observable change occurs. An interested Reactor subscribes with listenTo(subject), and adds a partial function to reactions that handles the event types it understands. deafTo(subject) ends that subscription when it is no longer needed.The connection is therefore made through publisher and reactor interfaces rather than through a hard-coded list of particular application classes. A reactor may observe several publishers and inspect an event's source to distinguish them. The implementation's registration machinery delivers published events to interested reactions; registering a reaction alone is not a substitute for subscribing to the source.[ref]
Scala Swing event-system documentation. Official library README, event-system description; Reactor API entries listenTo, deafTo and reactions
New to topics? Read the docs here!