The second alternative doesn't allow unmatched exceptions to be rethrown, at least not without heavy magic. That is the main point with a special syntax.
As for the first alternative, I think try/catch is better: It's known from other similar languages, and it's easier to tell apart from the current catch syntax. Actually, I'm not entirely sure there are no truly ambiguous cases if the first keyword is the same.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-10-01 20:51: Subject: Re: throw or return
I would prefer
catch { Stdio.format_filesystem("/dev/hda2", "ext5"); } handle (Exception e) { case e->invalid_file_system_type: // invalid file system type break; case e->no_permission; case e->not_mounted: // no permission or filesystem mounted break; }
and would think this to be even better
catch { Stdio.format_filesystem("/dev/hda2", "ext5"); } handle (Exception e) { if(e->invalid_file_system_type) { // invalid file system type break; } if(e->no_permission || e->not_mounted) { // no permission or filesystem mounted break; } }
/ Martin Nilsson (saturator)