|
|
|
|
|
by scroot
3239 days ago
|
|
There is no "formal" system for events, but there are patterns and most Smalltalk systems follow. For example, Pharo makes use of an object called `Announcer`, which you then subclass to make your own announcements. It works similarly to a pub/sub pattern, but using pure live objects and by sending specific messages to subscribers. Previously, systems like Squeak used a pattern where objects had a collection of "dependents" that would be updated when sent the `changed` message. I think this is still how input events -- keys, mouse, etc -- work in Morphic. In either case, the "handler" is whatever you want it to be, so long as the target object implements the appropriate message. As for discoverable, I'd say most things in a Smalltalk are easily discoverable, though some of the patterns can get convoluted if you're inheriting an ancient object structure. |
|
By "discoverable", I mean can the IDE:
1) Compile/analyze the code in the component library/run-time,
2) Figure out which type of method can be used for a certain type of event property for a given class, and
3) Display all matching methods in the current unit/module for the user to select.
This is what Delphi does (and Visual Studio with WinForms), and all of it is done at design-time, meaning that your application is not getting compiled in order to determine any of this.
From what you're describing, I don't think Smalltalk is doing the same thing. However, it could be doing something similar if it enforces (at design-time) this part:
"so long as the target object implements the appropriate message"