Yeah, something like that had occured to me to (although I would have
used @structure, not @interface). But... well... *YUCK!* :-) We're
trying to document an function parameter here, not an entire
interface.
... well, actually, technically it is an interface but the end-user
need is for a much more compact and ad-hoc method of defining the
interface inline, as part of the function comment as a whole.
I took a look at @config and, for the cases it addresses, it's much
more usable than the jGD counterpart. The problem is that its
(@config's) utility is pretty limited. It only allows you to
document simple name-type pairs. You can't specify a return type (if
you're trying to document a function), and you can't specify any sort
of signature if the property in question is a function (e.g. if param1
needs to point to a {String} function(int, int) or something like
that).
Granted, those cases are not as common - and certainly having an
@config-type option available would be nice, but it would be even
better if you could leverage existing tags to describe argument
parameters in the same way you describe objects and functions
normally.
We touched on this subject a while back in this thread:
http://groups.google.com/group/jgrousedoc/browse_thread/thread/4e2e4079655dc802/dd76cdfd79a24d1e?hl=en&lnk=gst&q=%40sig#dd76cdfd79a24d1e
Although at the time we were just thinking about how to document the
signatures of passed functions (and events), and not objects in
general.
By way of a suggestion, here's one possibility, which I'm sure would
be a parsing nightmare, but what the heck: Support nested interface
declarations inside the type brackets ({}). Mark's example might look
something like this:
/**
* @function myObject
* @param {@object
* @var {String} param1 comment_for_var
* @var {String} param3 comment_for_var
* } param_name comment_for_param
*/
... and a passed-function might look like this:
/**
* @function myFunction
* @param {@function
* @param {String} param1 comment_for_param
* @param {int} param2 comment_for_param
* @return comment_for_return
* } callback Comment for a function with an in-line interface
definition
*/
... and putting the two together for an example of how myFunction
could nest inside myObject:
/**
* @function myFunction
* @param {@object
* @var {String} param1 comment_for_var
* @var {@function
* @param {String} param1 comment_for_param
* @param {int} param2 comment_for_param
* @return comment_for_return
* } callback Comment for a function with an in-line interface
definition
* @var {String} param3 comment_for_var
* } param_name comment_for_param
*/
That last example gets a bit ugly, but is actually not too bad if you
consider the complexity of what it's expressing.
This would solve(?) half of the problem - how to author such ad-hoc
interfaces in the comments. The other half of the problem - how you
render such information in the generated docs - would still need to be
addressed.