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

Re: st: inline mata vs mo/mlib

From (William Gould, Stata)
Subject   Re: st: inline mata vs mo/mlib
Date   Wed, 10 Aug 2005 14:29:20 -0500

Roger Newson <> 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
*   For searches and help try:

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