That is quite neat code, but did you forget that FPC already has such a feature?
Nowhere near as yours, but it is there:
https://www.freepascal.org/docs-html/rtl/classes/ifpobserved.html
And everything descendant of TPersistent does have it.
Can you provide a demo or point to one where this feature is used?
I agree with LBoxPO's response to dsiders on the matter of an example.
Perhaps even a simple example of an observer is not so simple to show it within the framework of one post,
or Lazarus experts simply do not have free time to demonstrate this example.
Let's hope that one of the Free Pascal experts will someday have free time and a desire
to show a simple example of how to declare and use an observer.
By the way, while discussing this topic of an observer, I wondered if this method
is a good practice in terms of using hardware resources?
That is, declaring an observer is essentially starting a cycle that will run in the background
until the program is closed and eat up resources even when the program is idle.
That is, this will not be a single pass through the array inside the procedure launched by the user's click.
In short, if there are 100 or 1000 or 10k objects, then probably starting a cycle with each click or declaring such a number of observers
will equally use hardware resources, but what if the array of checked data-objects consists of 100k, 500k or more?
Wouldn't the announcement of millions of observers lead to an irrational use of hardware resources?