SQR "Code Alerts" | KEVIN RESCHENBERG 08-08-2007 |
Today, just a quick tip on debugging your SQRs. But first, if I may,
I wanted to show you a couple of new entrants into the zoo of SQR
quirks. Sometimes these things crop up in support requests for the
debugger, and other times I run into them in client code.
I've shown some oddities in past posts, but these two were
just recently found in the wild.
These are legal. They work (at least at the version I'm using).
do Proc-One(('A')
do Proc-One('A'))
do Proc-Two((0)
But then just when you think you see a pattern, the following
turns out to be illegal:
do Proc-Two(0))
Now look at this one:
let $x = 'Will SQR let
you do this?'
The result is the string "Will SQR let you do this?".
That seems odd, since the language reference specifically
prohibits it: "You can break a line in any position between words
except inside a quoted string." Why would the manual say this
is illegal if it actually works? There's a good reason. Look at this example:
let $x = 'Will SQR
let you do this?'
That one is illegal. See the important difference?
Now back to normal debugging. I wanted to point out a feature
of the SQR debugger that might
not be well known. On the toolbar you will see a "bug" button. This is
the Code Alerts button. When it's highlighted (not grayed out), it means
that the debugger found code that it thinks is a little suspicious. It checks for
a number of different situations. 90% of the time, your code will be OK
and these are false alarms. But on three different occasions during the
past week it pointed out real problems in my own code—a real shocker!
One of the situations it flags, for example, is when a variable appears only
once in your program. This can be fine, or it can indicate a misspelling.
If you misspell a variable name, you will end up with two different variables
instead of the one that you thought you had. That can lead to serious bugs.
Code Alerts will flag a number of situations within the delivered .SQCs. If
that's annoying, you can turn this feature off for .SQCs using File | Options.
Next time you're developing a new program, take a look at the alerts—you
might see something important.
|