[Gambas-user] [Gambas Bug Tracker] Bug #1256: Gambas compiler give error on valid code

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Wed Feb 28 03:53:46 CET 2018


http://gambaswiki.org/bugtracker/edit?object=BUG.1256&from=L21haW4-

Comment #2 by Benoît MINISINI:

Sorry, I was not true.

The code is valid in that case. It is equivalent to (bTest = True) And (sStr), and the interpreter is smart enough to convert the string to a boolean.

But I found that very dangerous, because sometimes this syntax does not do what you expected, I.e. chaining two tests, and this compiler check may detect that.

So I'm not sure I will remove the error message.

Moreover, the interpreter cannot optimize this kind of code, having one boolean to the left and one string to the right of the And operator.

I will think about it.

Benoît MINISINI changed the state of the bug to: Accepted.




More information about the User mailing list