Post by hydrophilic on Jul 27, 2014 18:21:10 GMT
I'm glad I never had to use BASIC v1, because I hear it was quite buggy, and in particular it ignored spaces when parsing keywords. This would make MANY legal statements (in any sane version of BASIC) fail. For example,
The reason, in case it isn't obvious, is in the expression "E > F OR .." where BASIC v1 thinks you mean the command/statement FOR. In this case you could fix the "bug" by using parentheses, but in some cases it is not possible.
Well they fixed the parser for v2, praise the Lord, but along the way, some genius thought it would be a good idea to allow GOTO to include a space. Thus a new token GO was added. And (except for v7.0) all it does it check for TO and does a GOTO if so (or error if not). The idea, obviously, is that GO TO is a synonym for GOTO.
Now besides polluting the syntax, this alternate GO TO (with a space) has bugs in that it does not work in some cases. One case, which I may have read about somewhere, but definately documented in my BASIC Reference, is that it does not work with ON preposition. So,
works fine and dandy but
will give you SYNTAX ERROR.
...
Just recently I discovered, to my shock and horror (because now I need to update my reference pages again), there is another case where GO TO fails: IF
Now there are two common ways to use GOTO with IF. I'll call the first, verbose mode:
that works fine with GO TO, byte way. The second form is the abbreviated, or as I like to call it, implied mode:
This "works" with both GOTO and GO TO, although that is stretching things a bit since neither is actually present! Third, uncommon form, is also an abbreviated version:
This will FAIL with GO TO giving SYNTAX ERROR.
I can't think of any more bugs with GO TO, can you?
Going off topic, both GO TO and GOTO require a literal number (a variable or expression generates SYNTAX ERROR). But on the C128, you can use GO expression where expression evaluates to 64; in this case it can be a literal number, a variable, or any math expression that evaluates to 64. (We all know about GO 64, right?) Anyway, it would be nice if GOSUB/GOTO/GO TO worked like that...
IF E > F OR E > G THEN PRINT "MESSAGE"
The reason, in case it isn't obvious, is in the expression "E > F OR .." where BASIC v1 thinks you mean the command/statement FOR. In this case you could fix the "bug" by using parentheses, but in some cases it is not possible.
Well they fixed the parser for v2, praise the Lord, but along the way, some genius thought it would be a good idea to allow GOTO to include a space. Thus a new token GO was added. And (except for v7.0) all it does it check for TO and does a GOTO if so (or error if not). The idea, obviously, is that GO TO is a synonym for GOTO.
Now besides polluting the syntax, this alternate GO TO (with a space) has bugs in that it does not work in some cases. One case, which I may have read about somewhere, but definately documented in my BASIC Reference, is that it does not work with ON preposition. So,
ON XP GOTO 100, 200, 300
works fine and dandy but
ON XP GO TO 100, 200, 300
will give you SYNTAX ERROR.
...
Just recently I discovered, to my shock and horror (because now I need to update my reference pages again), there is another case where GO TO fails: IF
Now there are two common ways to use GOTO with IF. I'll call the first, verbose mode:
IF A > M THEN GOTO 100
that works fine with GO TO, byte way. The second form is the abbreviated, or as I like to call it, implied mode:
IF A > M THEN 100
This "works" with both GOTO and GO TO, although that is stretching things a bit since neither is actually present! Third, uncommon form, is also an abbreviated version:
IF A > M GOTO 100
This will FAIL with GO TO giving SYNTAX ERROR.
I can't think of any more bugs with GO TO, can you?
Going off topic, both GO TO and GOTO require a literal number (a variable or expression generates SYNTAX ERROR). But on the C128, you can use GO expression where expression evaluates to 64; in this case it can be a literal number, a variable, or any math expression that evaluates to 64. (We all know about GO 64, right?) Anyway, it would be nice if GOSUB/GOTO/GO TO worked like that...