on Jan 10th, 2017, 4:26pm, Alincon wrote:I'm just curious why it did not fail. |
|
The short answer is because the program still makes perfect sense without the colon (as you've noted yourself LBB executes the code correctly). To maximize execution speed at run-time the LBB interpreter doesn't bother to check for, nor to report, syntax errors that don't actually matter.
Of course it would be possible for LBB to detect the error at the 'compilation' stage; it doesn't need to wait until run-time to do so. The fact that it doesn't in this case is partly an accident and partly because originally the expectation was that LBB would only be used to 'boost' a program that had been successfully compiled and tested in LB 4.04, so syntax checking was not a high priority.
When LBB was developed to be more self-contained and capable of being used on its own, the syntax checking and error reporting should have been improved. But, as I've discussed here previously, they weren't and some coding errors that could usefully be reported aren't. It's not ideal, but trying to retro-fit more checking at this stage would be difficult and risky.
I should add that the reverse situation also sometimes applies. This code (taken from freeform404.bas) executes perfectly in LB 4.04, with no error or warning being reported, but does not run in LBB because of the mis-matched parentheses:
Code: if mid$(mi$,brl,1)=chr$(0)) then brk=brl
Richard.