Re: Language Design
- Posted by David Cuny <dcuny at lanset.com> May 28, 2004
- 480 views
Lucius L Hilley III wrote: > Just great, Now I feel as if I've been tricked to accept goto's. Try/Catch offers a structured way of handling errors, and gives you the functionality of a Goto: constant leaveTheLoops = new_error() try for i = 1 to 100 do for j = 1 to 100 do for k = 1 to 100 do -- generate an error throw( leaveTheLoops ) end for end for end for catch leaveTheLoops printf( 1, "here i am!", {} ) end try Of course, Goto has less overhead (my own Basic interpreter uses setjmp/longjmp to implement Try/Catch) - there's potentially a lot of cleaning up you have to do internally when you reach the Catch to make sure that everything is dereferenced properly. -- David Cuny