[prev] [thread] [next] [lurker] [Date index for 2005/04/07]
I hate having to write ugly code. (Yes, this is another Delphi hate.) I like the fact that Delphi supports exceptions; they make error handling easier: try // code // code // code except on EFooError do begin // handle error end; end; Exceptions also necessitate cleanup clauses. In Delphi that's try...finally: try ... finally // cleanup end; Of, course, many times, you want to both handle errors and clean up allocated resources. This is where Delphi gets ugly: try try ... except on EError1 do begin ... end; on EError2 do begin ... end; end; finally ... end; And don't forget that if you raise an exception in a finally clause it clobbers the preceeding exception: try try ... except on Exception do begin ... end; end; finally try ... except on Exception do begin ... end; end; end; Ugh. Not to start any language wars, but there are other syntaxes that I find much more attractive. For example: (if (null (catch 'exception (unwind-protect (code) (cleanup)))) (handle-error)) (Granted, it's less structured than Delphi, so the programmer has to impose his own structure, but it *looks nicer*.) -- ...computer contrarian of the first order... / http://aperiodic.net/phil/ PGP: 026A27F2 print: D200 5BDB FC4B B24A 9248 9F7A 4322 2D22 026A 27F2 --- -- That's the thing about people who think they hate computers. What they really hate is lousy programmers. -- _Oath of Fealty_, Larry Niven and Jerry Pournelle ---- --- --
Generated at 20:00 on 07 Apr 2005 by mariachi 0.52