On 2/20/12 12:44 AM, foobar wrote:
I just died a little reading this. Are you suggesting that in order to handle IO exceptions I need to: try { ...whatever... } catch (PackageException!"std.io") {...} } catch (PackageException!"tango.io") {...} } catch (PackageException!"otherLib.io") {...} ...What the hell is wrong with just using an IOException?
There's nothing wrong, but there's a possible misunderstanding. If tango.io and otherLib.io cooperate with std, then they'd originate exceptions in std.io (as opposed to their own). Do note that the issue is exactly the same if libraries use IOException - they all must agree on using the same nomenclature, whether it's called PackageException!"std.io" or IOException. ModuleException and PackageException have one important thing going for them: they automate away a good amount of boilerplate, which makes them interesting for me to look at, and worth sharing as long as we're brainstorming. The associated issues as clear as the advantages. Probably ModuleException is too specific to be interesting, but PackageException seems useful.
AS Nick wrote, it seems you have a complete lack of understanding of how exceptions work which is unsurprising coming from a c++ expert.
Always eager to learn (so please come with all you've got), but quite honest I hope in a way you're exaggerating, seeing as a lot of the stuff I authored for D (the scope statement, exception chaining, a full chapter in TDPL) would be completely broken.
Also, this entire discussion you started about "improving" exceptions looks to me like a combination of NIH syndrome sparkled with heavy doses of premature optimization.
What is being optimized here? Thanks, Andrei
