Re: Smile dialogs
Re: Smile dialogs
- Subject: Re: Smile dialogs
- From: Paul Berkowitz <email@hidden>
- Date: Sat, 25 Nov 2000 11:16:53 -0800
On 11/25/00 9:45 AM, "Jason W. Bruce" <email@hidden> wrote:
>
>
The process of debugging in a window in which the scope and persistence
>
of variables may differ from the scope and persistence of those same
>
variables in your main script seems to me to be inherently bug prone. The
>
practice of writing solid code is as much a matter of adhering to safe
>
procedures during the coding process as it is a matter of knowing the
>
algorithms and the language. For this reason, I write and debug my scripts
>
in script windows, and use Text Windows as a diagnostic tool only.
Perhaps we have a semantic problem here. Since you can only do line-by-line
debugging in Text Windows, not Script Windows, the "diagnostic tool" you
refer to is what I, and Smile's documentation, and most people, call
"debugging", I think.
>
>
Many things work differently in text windows and script windows which
>
cannot simply be remedied by prefixing them with "my." When used in a text
>
window, for example, the terms "me" refers to Smile's Text Window class
>
script. In a script window, these terms of course refer to the script in
>
the script window. The run script command will succeed in some instances in
>
text windows and not in script windows. And certain list referencing
>
techniques which must be at the top level in a script window will work
>
within a handler in a text window, as you yourself pointed out to me some
>
months ago.
>
>
One of the goals of object-oriented languages is to achieve efficiency
>
by permitting the use of the same terms to do different things depending
>
upon the context. It seems to me to be fundamental that differences in the
>
treatment of scope and persistence of handlers and variables between text
>
windows and script windows can have important implications with respect to
>
this goal.
Nevertheless, I do all my debugging - when there really is a problem - in
Text Windows, and I have never had to rewrite a script between Text and
Script Windows after debugging it. I still can't figure out what you're
talking about, Jason. This seems like a red herring to me. Perhaps you're
needlessly foregoing Smile's diagnostic tools, or perhaps you actually do
use them whenever necessary: I don't know.
Look: when would global persistence of variables in Text windows create a
problem? If you start to debug a second script which uses the same variable
name as some variable which has already been defined in a previous text
window targeted to the same application, there shouldn't be any problem
unless you forgot to define the variable in the second script. That's the
only situation I can think of. Do you know of another? Otherwise the new
definition for the variable replaces the old. And that serious problem, if
you've actually included an undefined variable in your script, will be
immediately caught as soon as you transfer your second script to a Script
Window, compile it, and run Smile's newest feature - the Post-Compiler (the
version in Smile 1.7.4). That will immediately tell you that you are using
a variable which is not defined. In fact, if you're using Text Windows for
debugging only (is that what you mean by "diagnostic tool"?) you will have
already caught this when you first compiled the second script and won't have
the problem at all.
>
>
Remember, I'm a big fan of Smile and find its debugging features to be
>
quite useful. I just think they should be leveraged carefully.
I have a feeling that we use Smile in similar ways, Jason. Using it to best
advantage requires using all its various features, including both Text and
Script windows, appropriately. The main problem remains that the
documentation - even the excellent introductory Guided Tour - doesn't
explain how to do this. Partly this is because Smile is, as Peter says in
our review, "a moving target". The Post-Compiler has only just been
invented, but for me it's now one of Smile's most valuable features. (It
checks compiled scripts for undefined and unused variables.) I would very
much appreciate your input the next time we come to update the Smile review.
>
--
Paul Berkowitz