I agree. Its annoying. In the mean time you could try DP's XREF
utility. It lists all variables alphabetically together with the line
number on which it is defined and on which it is used. This quickly
reveals spelling mistakes and provides other useful debugging
information. Works a doddle on SMSQ/E too.
Per
On 24/04/2017 12:46, Michael Bulford wrote:
Hi all,
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.
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.
Michael Bulford
_______________________________________________
QL-Users Mailing List
_______________________________________________
QL-Users Mailing List