Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Debug mode in Mata


From   "David Elliott" <[email protected]>
To   [email protected]
Subject   Re: st: Debug mode in Mata
Date   Mon, 12 Jan 2009 21:10:37 -0400

I agree as well.  Simply saying "you screwed up just about here" would
be a great help.  I've used interpreted scripting languages that gave
error messages like:

display in puce "This is not an official colour"
                 ^    I don't understand what you meant here.

and they are certainly more helpful as to where the error occurred.
Having a dump of the local environment at the time of the error would
be helpful as well.  A -mac dir- will often give clues to what has
gone wrong.

Incidentally, I'll share a little programming trick I use.

As part of my syntax when developing a program I'll have a debug
option and then a couple of statements like:

local star *
if "`debug'" == "debug" { local star  }

then in the program I'll have:

`star' mac dir

or

`star' set trace on

to track macros and code through problematic section.  The `star'
macro comments out the debugging statements unless debug is on.

Without the debug option everything runs normally, with debug on, you
can get a lot of feedback at chosen spots.


-- 
David Elliott
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index