On Tue, 07 Oct 2014 16:34:12 +0200 Timon Gehr via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> import core.exception; > > void doStuff(){ } > > void main() nothrow{ > try{ doStuff(); } > catch(UnicodeException){ } > } > > Error: function D main 'main' is nothrow yet may throw that's not the same as 'final try': anything that is not UnicodeException or it's descendant will pass thru. for 'final try' anything other will crash the program immediately. no, 'assert(0)' is not the same. > > i'm talking about my proposal, where non-final try/catch will not > > make function nothrow, only 'final try' will do. > I.e. additional annotation overhead without a point? with a point. you even quoted it. > > and anything that not > > catched in this 'final' will abort the program immediately, without > > any tries to do unwinding or executing scope() statements. > > import core.stdc.stdlib; > > void doStuff(){ throw new Exception(""); } > > void main() nothrow{ > scope(exit) assert(0); > try{ doStuff(); } > catch(Exception){ exit(2); } > } i see *alot* of overhead here. and 'exit()', which will not show what exception was thrown. yes, we can print this info manually -- adding even more overhead. with 'final try' reader immediately recognizes writer's intentions.
signature.asc
Description: PGP signature