develooper Front page | perl.perl6.language | Postings from August 2009

Re: comments as preserved meta-data (was Re: Embedded comments...)

Thread Previous | Thread Next
From:
Timothy S. Nelson
Date:
August 12, 2009 22:08
Subject:
Re: comments as preserved meta-data (was Re: Embedded comments...)
Message ID:
alpine.LRH.1.10.0908131459050.3275@gwalcmai.nelson.org.au
 	I had an interesting idea I wanted to put out there.  If I'm being a 
good boy and commenting my code, I do things like the following pseudocode:

 	# Get the stuff and do other stuff with it
 	@lines = slurp("file");
 	@otherlines = map { s/foo/bar/ } @lines
 	putfile("file", @lines);

 	$t = 3;
 	....

 	Anyway, my point is, how much of the code does the comment apply to. 
I was thinking it might be a good idea to have a comment that indicates when 
the code that the previous comment applies to ends.  So you could have 
something like this:

 	#{ Get the stuff and do other stuff with it
 	@lines = slurp("file");
 	@otherlines = map { s/foo/bar/ } @lines
 	putfile("file", @lines);
 	#}

 	$t = 3;
 	....

 	...and then both people and parsers would be able to determine which 
part of the code your comment applies to, and we'd be able to automatically 
determine the comment coverage of our code, as well as the test coverage.  I'm 
perfectly well aware that the syntax I suggested about conflicts with the 
existing Perl 6 spec, and I'd love it if people suggested a better 
alternative.

 	Just to make myself clear, in the above example, I'm not commenting 
out any of the code, merely indicating which code the comment applies to.

 	Anyway, just some thoughts...

 	:).


---------------------------------------------------------------------
| Name: Tim Nelson                 | Because the Creator is,        |
| E-mail: wayland@wayland.id.au    | I am                           |
---------------------------------------------------------------------

----BEGIN GEEK CODE BLOCK----
Version 3.12
GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- 
PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y-
-----END GEEK CODE BLOCK-----


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About