[fpc-devel] modeswitch multihelpers
Sven Barth
pascaldragon at googlemail.com
Mon May 13 17:21:39 CEST 2019
Stefan Glienke <sglienke at dsharp.org> schrieb am Mo., 13. Mai 2019, 14:54:
> In fact it will use the last one that was found and fwiw this is imo bad
> and error prone behavior - I guess everyone has had that happen at least
> once that with some version change or update of some code some clash
> happened - especially when a routine with the same name but different
> parameters was introduced somewhere.
>
> I had the impression you are aiming for the best possible solution for a
> new feature so I brought this up - if you are happy with a "better than
> before" then please go for it.
>
It's in line with how helpers behave already:
Assume you have a class A with a method Foo that you call in your code.
You now add a unit with a helper for A that also has a method Foo. Then the
helper's method will be called.
If you now add a second unit with a helper for A with a method Foo then the
method of that helper is called.
This behavior is the same no matter if the new modeswitch is used or not.
The only difference is if you add a second unit with a helper that does
*not* contain a method Foo:
Without the modeswitch the Foo of the original class will be used.
With the modeswitch the Foo of the first helper will be used.
Yes, multiple helpers per type can bite you, but so can a single helper.
Helper types are a feature that should be used with care and that best have
some IDE support.
Regards,
Sven
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190513/4a5ab324/attachment.html>
More information about the fpc-devel
mailing list