LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2010, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 22 Jul 2010 15:04:18 -0400
Reply-To:     Nat Wooding <nathani@VERIZON.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Nat Wooding <nathani@VERIZON.NET>
Subject:      Re: Thoughts on nested comments?
In-Reply-To:  <BAY123-W229FBB0EA4169A9757893ADEA20@phx.gbl>
Content-Type: text/plain; charset="us-ascii"

Toby

Suppose you wish to have some statements that could be used in debugging should, heaven forbid, the production job fail? With a little forethought, these could be turned on by changing a single macro variable but otherwise remain silently waiting in case of ever being needed.

Nat

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of toby dunn Sent: Thursday, July 22, 2010 2:54 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Thoughts on nested comments?

Paul,

I am of the mind set that while developing I could care less if someone has commented out code. However, the final production code should never ever ever have commented out code. If the code is commented out then it shouldnt have been there in the first place. If one has to make changes to already existing production code then a simple naming convention would suffice to solve the problem.

Toby Dunn

"Don't bail. The best gold is at the bottom of barrels of crap." Randy Pausch

"Be prepared. Luck is where preparation meets opportunity." Randy Pausch

> Date: Thu, 22 Jul 2010 11:27:32 -0700 > From: paulandnancyoldenkamp@GMAIL.COM > Subject: Re: Thoughts on nested comments? > To: SAS-L@LISTSERV.UGA.EDU > > Hello SAS-L, > > > > I am uncertain that nested block comments are a good idea. > > > > Robert Martin says of commented out code in finished programs, "Few > practices are as odious as commenting-out code. Don't do this!" He says > that we should depend on modern version control systems to remember earlier > or alternative code. A Google search of 'commenting out code' will find a > lot of opinion on why programmers should not do this and it seems to me that > the points made also apply to SAS programming. > > > > Commenting out sections of code temporary while debugging is a practice > approved by some authors but others say that simply removing the unused code > is better and again the version control system can be used to revert back to > the previous code if necessary. This seems to fit your example. In that > example I think that when one wants to comment out the larger section from > step 2 to step 6 it would be best to first remove the commenting out from > step 3 and step 5. I think that this would make the operation clearer. > > > > A danger with these nested comments is that one might match up the start and > end of a block incorrectly. Suppose after commenting out from step 2 to > step 6 one wanted to go back to the only the two inner blocks. It seems too > easy to me to remove the '//*' before step 2 and by mistake the '*//' after > step 5 instead of step 6. > > > > The characters //* is a Java programming convention for toggling between > commented out and active code. It might be confusing to use it differently > in SAS programming. The SAS equivalent is > > > > */* ; > > Data ds1;x=1;run; > > * */ ; > > > > To comment out the datastep simply remove the first * in the first line. If > nested comments are implemented it might be better to use something like /*+ > . -*/ to start and end a block. > > > > There is a group of us under the sponsorship of PhUSE who are working on > programming guidelines for clinical trials and healthcare programming and I > have been drafting a section on the use of comments in code. I am wondering > if a guideline on commenting out blocks of code would be appropriate. What > statement on when to comment out and when not to would be useful for a > guideline document? I have a wiki sandbox at > > https://sourceforge.net/apps/mediawiki/os3a/index.php?title=SandBoxGppCommen ts > > and if you would like to make comments on the wiki 'discussion' page it > would be appreciated. What else should be said about commenting code? > > > > Paul OldenKamp > > POK Programming Co. > > Open Source SASR Software Applications project admin > > > On Tue, Jul 20, 2010 at 10:31 AM, Keintz, H. Mark <mkeintz@wharton.upenn.edu > > wrote: > > > Folks: > > > > This is an informal request to SAS-L for thoughts on a nested comment > > mechanism. I.e. if the next sasware ballot included an item like "introduce > > nested comments", how might the feature look in practice? > > > > > > JUSTIFICATION: > > > > AFAIK, SAS does not support nested comments. In particular a single "*/" > > cancels the effect of any number of preceding unpaired "/*" delimiters. > > > > I for one would appreciate the ability to nest comments. When developing, > > say, a 7-step program I may have steps 3 and 5 already vetted and each > > therefore commented out via "/* ... */". If, after further testing, I want > > to comment out steps 2 through 6, I can't simply insert delimiters before > > step 2 and after step 6. > > > > > > PROPOSAL: > > > > Add //* and *// as nested comment delimiters, such that: > > > > //* Increases the comment level by 1 > > *// Decreases the comment level by 1 > > > > > > EXAMPLE: using the 7-step program mentioned above, I start out with steps 3 > > and 5 commented with the proposed tokens. > > > > ... step 1 SAS code ... > > ... step 2 SAS code ... > > //* > > ... step 3 SAS code ... treated as a comment (level 1) > > *// > > ... step 4 SAS code ... > > //* > > ... step 5 SAS code ... treated as a comment (level 1) > > *// > > ... step 6 SAS code ... > > ... step 7 SAS code ... > > > > Subsequently I want to comment steps 2 through 6. I would add //* before > > step 2 and *// after step 6: > > > > ... step 1 SAS code ... > > //* > > ... step 2 SAS code ... treated as a comment (level 1) > > //* > > ... step 3 SAS code ... treated as a comment (level 2) > > *// > > ... step 4 SAS code ... treated as a comment (level 1) > > //* > > ... step 5 SAS code ... treated as a comment (level 2) > > *// > > ... step 6 SAS code ... treated as a comment (level 1) > > *// > > ... step 7 SAS code ... > > > > CONSIDERATIONS: > > 1. This feature should not be allowed to break the behavior of /* and */. > > In particular all comment levels established by //* would be subordinate > > to the effect of */, which would terminate all levels. > > > > 2. I know of no usage of the token "//*" in current SAS programs, and an > > unpaired "*//" would be treated the same as an unpaired "*/". So IMO these > > particular tokens are highly unlikely to be present in current programs. > > I.e. they shouldn't break any current code. > > > > > > > > (Ahem) Comments? > > > > > > regards, > > Mark > >

_________________________________________________________________ The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID283 26::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4=


Back to: Top of message | Previous page | Main SAS-L page