[Gambas-user] Bug with conversion?

Jussi Lahtinen jussi.lahtinen at gmail.com
Wed Feb 10 21:20:13 CET 2021


Thanks for clarification. That is what I suspected right after sending the
question.

Jussi

On Wed, Feb 10, 2021 at 10:16 PM Benoît Minisini <g4mba5 at gmail.com> wrote:

> Le 10/02/2021 à 21:07, Jussi Lahtinen a écrit :
> > There seems to be a case where Gambas does extra conversions or maybe
> > I'm missing something. See attachment.
> >
> > Look at the improved ArrayBoundsTest() function.
> >
> >  From these lines:
> > Debug gb.Integer
> > Debug TypeOf(iMyArray1.Bounds.Count);; TypeOf(iMyArray2.Bounds.Count);;
> > TypeOf(iMyArray3.Bounds.Count);; TypeOf(iMyArray4.Bounds.Count)
> > Debug [iMyArray1.Bounds.Count, iMyArray2.Bounds.Count,
> > iMyArray3.Bounds.Count, iMyArray4.Bounds.Count]
> > This is what I get:
> > mTest.ArrayBoundsTest.2548: 4
> > mTest.ArrayBoundsTest.2549: 4 4 4 4
> > mTest.ArrayBoundsTest.2550: (Variant[] 0x559e6c3b9178)
> >
> > I would expect integer[].
> >
> >
> > Jussi
> >
>
> iMyArray1 is an Object, i.e. can by any object datatype. So the
> interpreter can't assume that iMyArray1.Bounds.Count is an integer. It
> could be anything, according to the actual class of iMyArray1, and if i
> has a Bounds property that has a Count property.
>
> Regards,
>
> --
> Benoît Minisini
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210210/3ee301ea/attachment.htm>


More information about the User mailing list