Hijacking
Chris Nicholson-Sauls
ibisbasenji at gmail.com
Mon Aug 6 13:19:55 PDT 2007
Nick Sabalausky wrote:
> "Rioshin an'Harthen" <rharth75 at hotmail.com> wrote in message
> news:f974u9$9k1$1 at digitalmars.com...
>> "Walter Bright" <newshound1 at digitalmars.com> kirjoitti viestissä
>> news:f95leh$hn4$1 at digitalmars.com...
>>> It might be one of those things like exception specifications where
>>> everyone says it's a good idea but guiltily hate in secret <g>.
>> Exception specification *is* a good idea. Although I do hate it - try to
>> remember what a specific method may throw when you write your code,
>> especially if the error is ambiguous like "Unhandled exception" it's
>> really irritating - but I hate unspecified exceptions even more, as the
>> problem then is to even remember to put in the necessary try-catch-finally
>> blocks.
>
> Not to start a big big debate on it, but my own personal feeling on that
> (after having used a fair amount of it) is that the specification of
> exceptions belongs in generated documentation (whether javadoc-style or as
> part of the IDE as with "some_function() -> Called By..."). I normally
> prefer having to explicity specify things (yea, strong-typing fan here ;) ),
> but personally, I find it overkill in this case. (Not to mention it gave me
> flashbacks of writing C/C++ headers. j/k ;) ).
>
>
I didn't mind it at first, in that the Java compiler would then let me
know if I'd missed any potential exceptions...
...but when I noticed I was just adding 'throws A,B,C' to a lot of my
methods, I decided it wasn't entirely a great thing afterall. What
would have been better, I think, would have been to make throws
specifications /optional/. A thing libraries should do, but which
applications should be allowed to quietly "forget" most of the time.
Java is the language of conventions, after all.
-- Chris Nicholson-Sauls
More information about the Digitalmars-d
mailing list