[fpc-pascal] modeswitch multihelpers precedence problem

Sven Barth pascaldragon at googlemail.com
Tue Mar 10 11:08:42 CET 2020


Ryan Joseph via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
Di., 10. März 2020, 09:03:

>
>
> > On Mar 10, 2020, at 11:57 AM, Anthony Walter via fpc-pascal <
> fpc-pascal at lists.freepascal.org> wrote:
> >
> > To demonstrate, if I have MyUnit.pas that defines a string type helper
> with EndsWith() and an IntToStr() function then consider the following code:
> >
> > program Test;
> >
> > uses
> >   MyUnit, SysUtils;
> >
> > begin
> >   'hello'.EndsWith('lo'); // invokes MyUnit.TStringHelper.EndsWith()
> >   IntToStr(12); // invokes SysUtils.IntToStr()
> > end.
> >
>
> I think the problem here may be because SysUtils doesn't enable the mode
> switch. In that example above I would expect EndsWith to be used from the
> last unit, that is SysUtils. If you remake the example without SysUtils and
> define the type helpers in 2 units that both enable multihelpers  does it
> work correctly?
>

As Michael said the unit providing the helper has nothing to do with this.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200310/094748e3/attachment.html>


More information about the fpc-pascal mailing list