Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Why was -index()- dropped?


From   [email protected] (William Gould, StataCorp LP)
To   [email protected]
Subject   Re: st: Why was -index()- dropped?
Date   Fri, 25 Jan 2008 09:06:24 -0600

Roger Newson <[email protected]> asks,

> Why is the string function -index()- no longer available in Stata 10 (as it
> was in Stata 9 and several previous versions)?

As Richard Williams as already replied, The function -index()- was renamed
-strpos()- in Stata 9.  Both function names were recognized in Stata 9, but as
of Stata 10, the name -index()- is recognized only under version control.

Richard speculated this change had to do with Mata compatibility.  He's wrong
about that.

The problem was that the name -index()- just didn't suggest anything to most
users.  We would often hear questions about how how to determine whether a
string contained a certain substring, or the suggestion that we add such a
function.  We would reply -index()- and the response invariably was, 
"How was I supposed to think of that?"

The answer to that was, "Well, if you were a C programmer, you would have."
That's not a good answer, however, so we renamed the function -strpos()-.
Richard, however, is partially right.  At that time we were writing Mata, and
we thought it would be a good idea if all string functions started with -str-.

Richard commented that he wished that old names continued to work because one
gets used to doing things certain ways.

Richard's right.  We usually, with a lag, turn off off old names a matter of
policy.  We do that to keep our code (a little) cleaner and to get back names
for future development.  It was done unthinkingly in this case, however,
because we have no desire to get the name -index()- back.  Beyond that,
because -index()- is the name of a C function, there is a good argument for
Stata continuing to recognize -index()- along with the new name -strpos()-.

So we will quietly put -index()- back and make it work again.

The official name, however, is -strpos()-.

-- Bill
[email protected]
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index