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 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 20 Jul 2010 14:32:44 -0400
Reply-To:     Chang Chung <chang_y_chung@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Chang Chung <chang_y_chung@HOTMAIL.COM>
Subject:      Re: Thoughts on nested comments?
Comments: To: Mark Keintz <mkeintz@WHARTON.UPENN.EDU>

On Tue, 20 Jul 2010 17:31:17 +0000, Keintz, H. Mark <mkeintz@WHARTON.UPENN.EDU> wrote: ... >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? ... Hi, Mark:

There is this little language called Lua, which is popular among game developers. In Lua, double dashes start a line comment that ends with the end of line, like: -- this is a line comment It also has a block comment that can span multiple lines. The block comment starts with two dashes as well, it is however immediately followed by two left square brackets. The comment ends with *matching* two right square brackets: --[[ this is a comment block .... ]] But it is, by convention, usually written with two dashes before the closing brackets like: --[[ this is a comment block ... --]] because if you do this, then *un*commenting becomes as simple as adding one more dash at the beginning: ---[[ this is now open ... --]] Can you see why? This is because the first line is now a line comment with the content of "-[[", and the last line also become a line comment.

For nested comments, matching an opening to the correct closing may become a hassle. Lua allows any number of equal signs between the two brackets, so that you have immediate visual cues on which opening matches which ending. something like: --[[ some comments --[=[ some nested comments --[==[ inside the nested comments --]==] --]=] --]] Ain't this cool? :-) Cheers, Chang


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