I'm specifically referring to JavaScript anonymous function but this could be relevant to other languages. I like to use JSDoc notations in my scripts because I know other people will be hacking at it sooner or later. When i have pretty complex anonymous function how do people document it so that it gets picked up by Eclipse and other IDE's that understand JSDoc or JavaDoc notations?
/**
* Blah Blah blah
*
* @param Object Blah blah blah
* @return Blah Blah Blah
* @type Object
*/
function foo(this) {
......
this.bar = function () { ... complex code .....};
......
return obj;
}
Thanks
Ideally an anonymous function should be short and perform a straightforward task. So... the outer function that contains it should provide sufficient documentation.
If that is not the case you should likely extract the anonymous function out into a named function, and then properly document it.