[Gambas-user] If x <> +Inf Then [Error]

Jussi Lahtinen jussi.lahtinen at gmail.com
Wed Apr 19 02:49:06 CEST 2023


>
> I am away from my machine so I cant give a confirmed example, could be
> something like:
>
>     If hObjectA.StringVar And hObjectB.StringVar Then
>
> needs to be parenthesized
>
>     If (hObjectA.StringVar And hObjectB.StringVar) Then
>
> otherwise it evaluates the string lengths before the test, i.e. it "sees"
> the first as
>
>     If (Len(hObjectA.StringVar)>0) And (Len(hObjectB.StringVar)>0) Then
>     i.e. If ((1) And (1))
>
> or something like that anyway.
>
Here in both cases string lengths are tested to be non-zero. The condition
is true, if both of the strings are not null.
But parentheses can make a difference when mixing bitwise operations,
example these two are logically different:
If x = (y And z) Then
If x = y And z Then


> What I'm trying to say is that +/-Inf isn't the single root cause of the
> error, other things can do it too and sometimes it is hard to think the
> same way as the lexer and force the evaluation.'
>
The root cause is in the parser as the code cannot be compiled (it raises
false error). It's not about ambiguity.


Jussi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230419/a5347441/attachment.htm>


More information about the User mailing list