MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Dialogs and inheritance

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76526] Re: Dialogs and inheritance
  • From: ragfield <ragfield at gmail.com>
  • Date: Wed, 23 May 2007 05:35:02 -0400 (EDT)
  • References: <f2u3c3$j45$1@smc.vnet.net>

On May 22, 12:42 am, "alexxx.ma... at gmail.com" <alexxx.ma... at gmail.com>
wrote:
> Hello,
> I'm trying to learn to use Dialogs for debugging purposes - since I
> cannot learn the right way to use the integrated debugger.
> Can you please tell me what is wrong in the following???
>
> In[1]:= Module[{a},
>  Do[
>      a = {i, Sin[i]};
>      Dialog[],
>   {i, 100}]]
>
> (Dialog) In[2]:= i
>
> (Dialog) Out[2]= 1
>
> (Dialog) In[3]:= a
>
> (Dialog) Out[3]= a
>
> I thought under Dialog I could be able to see all the local values of
> the variables!


The reason you don't see a value for "a" is because the variable is
not named "a".  Module changes the name of variable when it is
evaluated.  The actual name is something like "a$5224" (which can
easily be seen with the debugger).

To use the debugger with this example, try the following:

* enable the debugger is enabled by choosing Evaluation > Debugger
from the menubar.
* a palette will pop up
* remove the Dialog[] from your example, as it not necessary and may
cause problems with the debugger
* select the code you are interested in examining (e.g. triple click
on the "a")
* press the "Break at Selection" button in the debugger palette
* evaluate your example
* note that the evaluation pauses and the "a = ..." block is
highlighted.
* click "Show Stack" in the debugger palette
* this brings up a window showing you what is evaluating
* in the stack window click the opener triangle labeled "Local
Variables"
* here you can see that a (or a$5224) does not yet have a value
* press the "Step" button in the debugger palette
* note that "a" now has the value {1, Sin[1]}
* press "Step" again
* note that "a" now has the value {2, Sin[2]}
* etc.
* press "Continue" on the debugger palette a few times
* it will stop each time it hits the "a = ..." breakpoint
* click the "Show Breakpoints" button on the debugger palette
* delete the breakpoint
* press "Continue" on the debugger palette
* the evaluation will complete

-Rob



  • Prev by Date: Re: Re: Re: v. 6, third argument to rectangle
  • Next by Date: Re: Evaluation Question
  • Previous by thread: Re: Dialogs and inheritance
  • Next by thread: Evaluation Question