Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: RE: Critique on comment syntax and suggestions


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: RE: Critique on comment syntax and suggestions
Date   Fri, 28 Jan 2011 17:51:50 +0000

Thanks for the reference.

On this point I think it mostly boils down to personal taste.

The history is simple: the original developers of Stata were highly
active and experienced C programmers before they ever invented Stata.
I suspect this detail was for their use when so inclined, and not just
for users outside the company. However, the publicly visible house
style of StataCorp is to use #delimit ; very sparingly. But that has
no implications for anyone else.

But if I follow Bryce correctly there is a small bug in the do-file
editor, which regardless of taste is an action point for StataCorp.

Nick

On Fri, Jan 28, 2011 at 5:38 PM, David Radwin <[email protected]> wrote:
> Bryce,
>
> I was tripped up by the interaction of semicolon delimiters and comments
> recently, too, as were others in the past, before the built-in editor had
> syntax highlighting:
>
> http://www.stata.com/statalist/archive/2008-11/msg01338.html
> http://www.stata.com/statalist/archive/2008-09/msg01271.html
>
> But there is another solution: don't use semicolon delimiters, even if you
> are accustomed to using them in other software.
>
> Nick Cox makes this point in "Suggestions on Stata programming style"
> (Stata Journal 2005, vol 5, Number 4, pp. 560-566).
> http://www.stata-journal.com/sjpdf.html?articlenum=pr0018

Mason, Bryce

>> Although not a question, thought this might be of interest as a
> "gotcha."
>>
>> I was stymied by poor commenting practice but also by STATA's inflexible
>> color coding of comments. Consider the following:
>>
>> # delimit ;
>> * This next line won't get processed because I forgot to put a semicolon
>> drop if criticalvar=1;
>>
>> Unfortunately, STATA's do-file editor inappropriately colors the line
> with
>> the drop command as if it will be processed, even though the delimiter
> was
>> not applied to the comment line. It would be great if the do-file editor
>> knew that we were using a semicolon and made that whole section green
>> until it encountered a semicolon, but I do not see this being easily
>> implemented.
>>
>> We will be moving our standard commenting practice to /* and */ in order
>> to avoid this issue.
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index