Many thanks for checking. I have made an in-depth study of the Qliberator Manual. It says ... The control variable of a FOR..END FOR loop cannot be a formal procedure parameter or an error will occur.
Apparently the idea dates back to 1984 in the days of the AH and JM ROMs. In those days a SELect variable and also a FOR control loop variable had to be of type floating point. If this were not the case the program would not work as intended. To demonstrate this, consider the following program ...
Code: Select all
100 main 7 DIV 1
110 :
120 DEFine PROCedure main(i)
130 PRINT "i = "; i
140 SELect ON i = 7 : = REMAINDER : PRINT "That's not a 7"
150 FOR i = 6 TO 8 : PRINT "i = "; i
160 END DEFine
Now, all SuperBASIC procedure and function parameters take their type from the incoming argument. The use of the SuperBASIC infix operator "DIV" in "7 DIV 1" makes that expression an integer type. When "main" receives this "7 DIV 1", the "i" will be instantiated to that value and will get to be of type integer, and not of type floating point. From thence forward we can expect trouble. Running this code on a JM QL produces the following output ...
i = 7
That's not a 7
i = 2051
i = 2051
i = 2052
This output is clearly incorrect!
We can now see what Qliberator has done. In order to prevent incorrect results from happening, Qliberator has deliberately stopped the program. When this happens, the line number and the error report of FOR type error appears on the screen. The idea is that the programmer would recognise was has happened and correct the code. So, Qliberator is doing a very good thing and is enhancing the QL experience! Owners of QLs with either an AH or a JM ROM would do well to get this compiler.
In my opinion, it is the implementation of this idea which is at fault: it goes too far and also stops programs that have been correctly coded.
Michael Bulford
EmmBee