On Sep 3, 8:09 pm, "R.Nicholson" <rhnlo...@[EMAIL PROTECTED]
> wrote:
> And a programmer
> who knows how to use goto's might end up with a better
> feel for the hardware representation of a CPU.
I seriously doubt that. It certainly doesn't apply in my case; I was
an assembly language programmer long before I was a BASIC programmer,
and of course all my BBC BASIC interpreters are written entirely in
assembler code, so I have a pretty good idea of the CPU's hardware
architecture. Being forced to use 'gotos' all the time in my
assembler code doesn't make me any more inclined to use them in my
BASIC programs.
I would say it's also pretty significant that the person who designed
and coded the original BBC BASIC (Sophie Wilson) was also the co-
inventor and designer of the ARM processor, and indeed the ARM was
first simulated and tested in BBC BASIC!
> The other reason why a Basic implementation should have a
> GOTO statement is that it is required by the ANSI Minimal
> Basic Standard
I can't recollect there being any consideration of the ANSI Standard
when the BBC specified what was to become BBC BASIC in 1980/1981.
Either we didn't know about it or didn't care (or both)!
> Line numbers, as GOTO targets, in Chipmunk Basic must
> be in ascending order and spaced apart by at least
> the number of intervening lines. This does cause
> some incompatibilities with later MS qbasic code
> which allows line numbers out of order.
BBC BASIC's line numbers must be in ascending sequence, but there's no
requirement for any minimum spacing. The first line can be line 1 and
the last line 2, with all the others unnumbered, if you like.
> Just to help prevent this, Chipmunk Basic will clean up
> any broken for/next stack fragments at any more outer loop
> or subroutine return.
Yes, BBC BASIC will also clean up the stack on a function or procedure
return, so it's safe (from a stack point of view) to use GOTO there.
However, you can often achieve the same effect just by exiting from
the function prematurely - which is equivalent to a GOTO without
actually using one.
Richard.
http://www.rtrussell.co.uk/
To reply by email change 'news' to my forename.


|