On Sun, 12 Aug 2012 22:01:49 +0100, Jonathan M Davis <jmdavisp...@gmx.com> wrote:

On Sunday, August 12, 2012 16:33:39 Adam D. Ruppe wrote:
Perhaps a workable compromise is to make ddoc able to
automatically output the throws list.

That way, we don't have the hassle of checks, but we do have a
maintained list at relatively no hassle.

That's both a good idea and bad idea, because all it's going to be able to list is the exceptions thrown directly in the function. In order to list them all, it would have to go digging through the whole call list (which not only would be expensive, but isn't even necessarily possible if the source isn't
fully available), and if any classes are involved, then inheritence could
totally mess up the list, since different derived classes could throw different
exceptions.

So, unless all you care about is what's thrown directly from the function, you'd end up with a very incomplete list. The advantage is that you'd at least have a partial list, but if it gave the impression that it was the whole list, then that would be a problem. Of course, writing it by hand also tends to only
list what gets thrown directly (or maybe also what's thrown in the direct
helpe functions), so there wouldn't necessarily be much difference. So, it may be close to what would be written by hand. It's definitely true though that it
won't be listing all of the thrown exceptions in the general case.

I wonder if it might be possible to make an intellisense style GUI/IDE tool/plugin which could determine all exceptions thrown either by direct code inspection or ddoc inspection (when source is unavailable) such that it could actually build a complete list. It would need to cache results in order to be anywhere near performant I reckon.

R

--
Using Opera's revolutionary email client: http://www.opera.com/mail/

Reply via email to