RUNing appears to work; its when EXing this program that the problem
shows up.
I believe its possible to get an error on RUNing too, I just havent
been able to recreate the conditions.
Typical errors are:
At line nnn: <nothing>
At line <somewhere far away from the problem>: undefined loop control
variable
etc, all nonsense
Clearly, EXecuted SBASIC programs get a different environment than
RUNed ones. Like the "program":
100 PRINT
110 END REPeat loop
doesnt throw an error when RUN, only when EXecuted.
Per
On 22/11/2022 17:13, Wolfgang Lenerz via Ql-Users wrote:
Hi,
Does anyone know whats going on here?
Nope...
Even stranger : once you run this and it failed, change the variable
name ("ch") to something else (like "cht") everywhere . Run it - and
it works. Save the prog with that new variable name, start a new
basic session, load the prog, run it- and it fails. Change "cht"
back to "ch" - and it works.
Have fun (?)
Wolfgang
SBASIC only: EXecute the following program:
>>
100 ch = FOPEN("con"): CLS#ch
110 test ch, 1
120 PAUSE#ch
130 CLOSE#ch
140 :
150 DEFine PROCedure test(ch, a)
160 PRINT#ch; a
180 END DEFine test
Result in this case:
At line 150:4 DEFines may not be within other clauses
However there are various error conditions depending on how the
program
is constructed. In the worst case it just hangs and must be RJOBed.
What seems to get the interpreter's knickers in a twist is a parameter
being referenced using the same name as the parameter, 'ch' in this
case.
This is supposed to be perfectly "legal". I dont know when this
behaviour
started but Ive noticed it for a while.
It would be nice if this could be fixed as, for example, in larger
projects, when using library code you dont necessarily notice that
variable
names are the same a parameter names, and so you may end up getting
unexplained hangs or obscure error messages that dont actually
relate to
the problem.
Per
_______________________________________________
QL-Users Mailing List
_______________________________________________
QL-Users Mailing List
_______________________________________________
QL-Users Mailing List