On Sep 3, 2:50 pm, "Judson McClendon" <ju...@[EMAIL PROTECTED]
> wrote:
> Richard, surely you aren't saying that functions and subroutines can
only
> have numbers instead of labels?
The specification for BBC BASIC does not include any sort of labels,
and (with the exception of the 'unofficial' sup****t in recent versions
of 'BBC BASIC for Windows') no version of BBC BASIC provides them. If
you *must* use GOTO in BBC BASIC then you have no choice but to number
the destination line.
> Though I understand your objection to
> using goto, if someone is going to use goto anyway, wouldn't "goto
> <meaningful-label>" be better than "goto <meaningless-number>"?
This has been argued to death in the BBC BASIC community, on and off,
over the last 25 years! The view that I have always taken, and I
think it's the dominant view of BBC BASIC users, is that not having
labels is a useful 'encouragement' not to use GOTOs.
Even in 1981 it was recognised by the BBC and Acorn that GOTO should
not be used, ever. I know that's a controversial viewpoint, but many
people believed it then as they do now: Dijkstra's famous dissertation
'Go To Statement Considered Harmful' was, after all, published way
back in 1968 (Communications of the ACM 11:3, pp 147-148).
The *only* reason GOTO was specified for BBC BASIC was for
compatibility with existing programs (usually written for some variety
of 8K Microsoft BASIC), and of course that only required sup****t for
line numbers. I don't think any version of BASIC had labels in those
days. The assumption was that any program written specifically for
BBC BASIC would not use GOTOs.
> The only goto's I could find in programs
> since the 1970's were to handle error or termination situations where
there
> was no better syntax available, such as "ON ERROR GOTO".
In BBC BASIC you can achieve an 'implied GOTO' by where you position
the ON ERROR statement in the code, since execution continues after
that statement.
> One was to exit from a deeply nested FOR/NEXT structure.
If you use GOTO to do that in BBC BASIC it will eventually crash,
because of a stack overflow. This is another good argument for not
using GOTOs, since their use can result in insidious bugs which don't
cause an immediate error but may do after running for hours, days or
months: a most horrendous kind of bug to have in a continuously-
running program like a control system.
Anyway, BBC BASIC for Windows now has EXIT to do that properly.
Can I make a plea that this thread doesn't turn into a fruitless
argument about whether GOTOS are good or bad, necessary or
unnecessary. People have such entrenched views on the subject that
further discussion would generate only heat rather than light. By
providing limited sup****t for labels in BBC BASIC for Windows I am
sitting firmly on the fence and intend to stay there!
Richard.
http://www.rtrussell.co.uk/
To reply by email change 'news' to my forename.


|