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

Werner Pamler werner.pamler at freenet.de
Fri Apr 12 22:29:59 CEST 2019


Am 12.04.2019 um 20:23 schrieb Ondrej Pokorny via lazarus:
> 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?

I mixed up loading and and toggling between form and code view, and my 
memory refers to Delphi. I just tested it again: After loading a D7 
project with a VirtualTreeView into Delphi XE2 and pressing F12 to 
toggle to Form view I get the error "Method ... to which 
VirtualStringTree1.OnGetText refers has an incompatible parameter list" 
because the D7 event signature contains a widestring parameter, but the 
XE2 event contains a normal string parameter. - When i load the 
toolsdemo mentioned in the first message into Lazarus and press F12 
nothing happens although the parameter list is different. Strange.


> 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 :)

Don't worry, it will be changed shorty, but I wanted to have an example 
which every interested reader could test easily without having to 
install anything.


More information about the lazarus mailing list