-capture program drop- imposes a slight overhead
and should thus be left off the top of any program
you are not currently developing. On the other hand,
you'd be sharp if you noticed a change in Stata's performance.
Conversely, the irritation or confusion possible
given different versions, old and new, is such that
I edit ados using -fedit- from SSC, but modified
so that it uses my favourite editor. This builds in
an automatic -discard- of everything. In machine
terms that's wasteful, but I'm valuing my own time
and stress more highly, as any programmer should.
Nick
[email protected]
Jun Xu
> I would guess the function of cap program drop is to prevent
> error while
> doing some live editting. For example while you use do file
> editor (or
> textpad) to write an ado file, if you don't insert a line of
> cap program
> drop at the very beginning, then every time you make a change
> and you want
> to rerun your ado file, it will give your an error message
> because the
> program name is already defined. You can check into the ado
> folders. Some
> ado's have that line, others don't. My guess is that cap
> program drop is
> some leftover for doing live editting (trial and error
> process of writing the ado file).
Richard Williams
> >At 10:37 PM 3/26/2005 -0600, Jun Xu wrote:
> >>I think you probably have to rerun the ado file or discard
> it first. I
> >>think that's way how it works. Though you specified cap
> program drop
> >>myprog in the ado file, without truly running the ado file,
> this line is
> >>not executed by simply overwriting the old ado file. The
> old ado version
> >>is still in memory. My guess is that once an ado command is
> executed, it's
> >>in memory and unless you EXECUTE (do myprog.ado) the new
> version or tell
> >>Stata to discard, Stata won't execute the newly updated
> ado. Others might
> >>have comments.
> >Thanks Jun. I still wonder if I am doing something wrong or missing
> >something obvious, as I've seen other programs start with
> -capture program
> >drop progname-.
> >
> >Anyway, I have found a solution. I've written a program whose sole
> >function in life is to call the program I am editing/debugging:
> >
> >program define x
> > capture program drop myprog
> > myprog `0'
> >end
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/