On Wed, 2006-12-13 at 21:33 -0800, Erick Tryzelaar wrote:
> Say we wanted to have something like the classic try-finally,
I suppose it is possible, given some assumptions .. but it
isn't clear what works best.
try
p();
finally
f();
end;
normal:>
print "normal exit";
exit();
proc p() { if bad goto err; }
err:>
print "error;
exit();
could be written:
q();
f();
proc q() { if bad do f(); goto err; done; }
normal:>
print "normal exit";
exit();
err:>
print "error;
exit();
or something similar. Perhaps you could write the
exception handler to accept a 'finally' proc as
an argument.
Perhaps you could define 'throw' to automatically execute
the finally argument, but the 'throw' would have to be
lexically inside the try/finally statement for the user defined
syntax to see it.
The problem here is syntax. Originally, Felix has some
syntax for exceptions but I took it out because I had
no idea what I was doing.
I still don't. I'm inclined to try to use typeclasses
to try out monads instead :)
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language