Michael Van Canneyt
michael at freepascal.org
Fri Sep 26 09:39:20 CEST 2014
On Fri, 26 Sep 2014, Michael Schnell wrote:
> Yesterday, I had a discussion with a colleague about programming languages.
> He said that he did not like Object-Pascal / fpc because it lacks the concept
> of "signals" he finds in other languages / libraries. (He is not an expert
> but discusses on base of rumors he collected.)
> With "signals" he meant a kind of multi-target events.
> He described that multiple parts (units) of a program (or even units within a
> set of sunning programs) can "subscribe" to a signal (or several of them),
> and whenever anyone "rises" a signal all subscribers get notified and can
> Seemingly the execution line in such a "unit" might be as well the main
> thread or a worker-thread (or even another task/program) and the event
> handler can be defined to work on this thread (he did not elaborate if always
> or optionally a newly created thread can be used).
> Unfortunately I was not able to come up with a similarly powerful concept
> available in fpc.
You can use the Observer pattern; it is in the classes unit.
And to be honest, this is not a language concept, but a library concept.
It can be easily implemented.
More information about the fpc-devel