This isn’t just a Xojo debate. API 2.0 is reported to use exceptions rather than error codes.
And I’m sure that once preliminary releases of a version with API 2.0 are out that this debate will start in earnest.
Personally I’ve used both. The biggest difference with how I’ve used exceptions in the past in other languages was their built in support for “checked exceptions“. I’d love to see this in Xojo as it makes it so the compiler can at least help you out by giving you a compilation error when you haven’t thrown or caught an exception that you must.
Something like this makes it much easier to track down how an exception propagates since every called method MUST declare it in one way or another. They cant just silently say nothing.
However I doubt Xojo’s compiler guy(s) would add it.
There are some great articles that argue both for and against exceptions and error codes. They are great reading and they are persuasive in both directions.1
But, for my money, if Xojo is going to move to exceptions, checked exceptions would be my preference simply for the clarity it adds.
- reading links