On 2/21/2011 7:22 AM, Lawrence D'Oliveiro wrote:
In message<
[email protected]>, Kevin McMurtrie
wrote:
Formatting comments incorrectly so they don't appear in the IDE?
Which “IDE†would that be, then?
He is referring to the use of Javadoc comments. Instead of
public byte[] ReceiveChunk()
/* receives a complete chunk from the connection. */
You should write
/* receives a complete chunk from the connection. */
public byte[] ReceiveChunk()
This will allow the IDE to display the comment when you hover your mouse
above references to this method.
Why can’t this “IDE†handle the more natural style?
There is nothing more natural about having method/function comments
after the signature than before it.
Except that sentence expects its subject to come at the start.
Again, assuming that this is what you meant, you might as well get used
to source documentation tools (including their use by IDEs) requiring a
specific location for rich comments.
My “source documentation tools†ARE the comments.
Here’s one of my more complex examples (in Python):
def ProjectNumberListList \
(
Prompt,
# to display next to the list (may contain HTML markup)
FormName,
# the name of the form for use in generated JavaScript
PostListDef,
# additional HTML to go after project list (e.g. fields showing
# info about currently-selected project)
SelectedProject = None,
# the ID of a project to preselect; if None, defaults to current value of CGI parameter.
ProjectGroupVarName = None,
# optional name of JavaScript variable to be assigned table of project group IDs
ProjectNameVarName = None,
# optional name of JavaScript variable to be assigned table of project names
ProjectContextVarName = None,
# optional name of JavaScript variable to be assigned table of project dialout contexts
ProjectEnabledVarName = None,
# optional name of JavaScript variable to be assigned table of project-enabled flags
ProjectPredictiveVarName = None,
# optional name of JavaScript variable to be assigned table of predictive-enabled flags
ProjectCallRefusalsVarName = None,
# optional name of JavaScript variable to be assigned table of call-refusals-enabled flags
ListsVarName = None,
# optional name of JavaScript variable to be assigned table of number list names by project
ListsEnabledVarName = None,
# optional name of JavaScript variable to be assigned table of number-list-enabled flags
# by project
PrimaryFieldsVarName = None,
# optional name of JavaScript variable to be assigned table of primary field names
RefreshCall = None, # optional JavaScript sequence intended to initialize project-list display
) :
# outputs HTML allowing the user to choose a project, and also choose
# from the available number lists already in that project.
Assuming "natural" locations completely falls flat on its face for a
bunch of other things, like Java annotations or C# attributes.
But those aren’t comments.