[fpc-pascal] Generic type conflicts
Sven Barth
pascaldragon at googlemail.com
Thu Nov 7 18:25:12 CET 2019
Michael Van Canneyt <michael at freepascal.org> schrieb am Do., 7. Nov. 2019,
16:23:
>
>
> On Thu, 7 Nov 2019, Ben Grasset via fpc-pascal wrote:
>
> > On Thu, Nov 7, 2019 at 3:03 AM Sven Barth via fpc-pascal <
> > fpc-pascal at lists.freepascal.org> wrote:
> >
> >> If there is no type checking, then it is *not* verified by the compiler.
> >>
> >
> > Perhaps "no type checking" was not the write way to put it. A better way
> to
> > describe it might be:
> >
>
> [snip]
>
> > E.G. it could still do the full checking, as the only thing that really
> > matters is that it does not actively raise error messages only relevant
> for
> > Integer under code blocks only entered for tkFloat.
>
> If I understood Sven's example correct, then the compiler does exactly this
> already.
>
Not quite. If the generic parameter T is a LongInt, then the branch for
tkFloat *must* also be valid for LongInts. Because the type checking is
done *before* the branch is discarded.
Regards,
Sven
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20191107/5ecd8f6c/attachment.html>
More information about the fpc-pascal
mailing list