[Lazarus] Event with changed signature can be loaded without error

Ondrej Pokorny lazarus at kluug.net
Fri Apr 12 20:23:33 CEST 2019


On 12.04.2019 19:35, Werner Pamler via lazarus wrote:
> I don't know: is this changed or am I fooled by my memory? I was 
> rather sure that when the signature of a published event is changed, 
> forms saved with the old signature cannot be read without error. But 
> now I notice that this is not true any more.

AFAIR it has always been so. Didn't you mix up with virtual methods?


> The version of TAChart which I just committed to trunk had to change 
> the signature of the TChartDataPointDrawEvent event from
>
>    procedure (ASender: TDataPointDrawTool) of object;
>
> to
>
>  procedure (ASender: TDataPointDrawTool;  ADrawer: IChartDrawer) of 
> object;


You must never change the signature of published events. You pick up a 
new name, deprecate the old one and after a stable release you delete 
the deprecated one. In this way you still break compatibility, but in a 
way that the user is notified about it.

I hope you will have more understanding for breaking changes in the 
future after this experience :)

Ondrej



More information about the lazarus mailing list