Yes, everyone should read "A Brief History". But exactly this case was
not bespoken ;-).
Am 24.04.2017 um 18:27 schrieb Dilwyn Jones:
When QDOS evaluates an expression and encounters a variable with no
value assigned, it STOPs with “error
in expression” and reports the line number. The programmer may well
have made some spelling mistake, and can immediately make a
correction. QDOS is doing exactly what the programmer wants.
When SBASIC was first mooted, I remember that there was at the time
discussion that other BASICs gave variables default zero value rather
than stopping with an error - "why couldn't the QL do this?"
Can SMSQ/E be upgraded to follow suit?
Currently, in the above-mentioned case, SMSQ/E will use a zero value
and will carry on blindly with no error reported. The assumption is
made that any new variable will have a default value of zero. This
behaviour does not take account of the fact that people are human and
will sometimes make spelling mistakes. The unintentional mistake
gets buried and lost in the middle of the code. I can spend a great
deal of time and effort composing a program; I can type it all in,
and can even double check it, but I can still overlook things. After
writing a program in SMSQ/E, I can never be certain that it is free
of typos. There is this constant anxiety in the mind. Programming
can be difficult, even without the additional workload required of
having to track down possible spelling mistakes, when there might be
none at all - one can never tell. QDOS is much friendlier in this
respect. This is why I would like for SMSQ/E to be upgraded to act
like QDOS. If this would entail a slight loss of efficiency, then
that would be acceptable. For me, the most important aspect of
programming is to be able to write code that is going to work as
intended. If SMSQ/E could be upgraded, then this would mean that all
new variables would need to be initialised with values before
they are used. This would apply to both global and local variables
in procedure/functions. However, this is a recognised good practice
in any case. It is good practice because these initialisations are
being documented. We have to remember that others will want to look
at and understand the code we write. SMSQ/E would be enforcing this
desirable state of affairs, as QDOS does.
Don't know if that influenced Tony Tebby to make SBASIC variables
behave in this way or not, or was that just coincidence?
QL-Users Mailing List