Hijacking

Robert Fraser fraserofthenight at gmail.com
Mon Aug 6 13:58:57 PDT 2007


Chris Nicholson-Sauls Wrote:

> 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

I'd like it to be required in the method where the exception is thrown for checked exceptions, but not in any calling methods (they're just optional there). But I'm not too passionate about the point... I can live with 'em (they're a bit annoying, but I can see their advantages), and I can live without 'em.



More information about the Digitalmars-d mailing list