Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: inline mata vs mo/mlib


From   wgould@stata.com (William Gould, Stata)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: inline mata vs mo/mlib
Date   Wed, 10 Aug 2005 14:29:20 -0500

Roger Newson <roger.newson@kcl.ac.uk> writes,

> While still on the subject of good Mata practice, -[M-1] naming- 
> recommends that we name our functions with long names [...]  I have
> just written a pair of Mata functions named _balancedtree() and
> balancedtree(), which I intend to distribute in due course. 
> Should I rename them?

That's on the border, but I think the names are okay if balancedtree() and
_balancedtree() are functions you intend to document,  that you think of as
useful general utilities, and that you intend that other users will use.

If these are functions you intend to document and that you think other users
will use, but you do not think of them as general utilities, then I suggest a
prefix.  For instance, we might imagine that you are writing a tree-balancing
system, and so you might name the routines tbbalancedtree() and
_tbbalancedtree().  All your functions would begin with the letters -tb-,
which would help to keep them together, and that, coupled with longer names,
virtually assure that the names will not cause problems.

On the otherhand, if balancedtree() and _balancedtree() are just part of your
system, and the names rather appeal to you because they make your code look
nicer, I suggest longer, uglier names.

(If the code for balancedtree() and _balancedtree() appears in an ado-file, 
then it does not matter how you name the functions, because  those names
really are private.)

-- Bill
wgould@stata.com
*
*   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/



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