Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Which programming language first came up with the finally block?

I ask purely out of curiosity.

It is a very useful piece of syntactic sugar, and whoever first created it surely has a very impressive grasp of solutions to programming problems.

(Note: it is deceptively difficult to find an answer to this question...)

share|improve this question
3  
Why would you call it syntactic sugar? –  Pieter B Oct 1 '14 at 18:05
2  
Related reading: Why is there no 'finally' construct in C++? –  Snowman Oct 1 '14 at 18:06
    
@PieterB the block helps avoid duplicate code (copy pasting the statement into try and each catch block). A try-finally block helps avoid a try-catch-rethrow block which is ugly, harder to understand, and defeats the purpose of such blocks. To quote another source, everything can be accomplished without the finally block, but everything also can be accomplished on a Turing Machine. That doesn't make it good form, though. –  patstuart Oct 1 '14 at 18:13
1  
@PieterB because you can replace try{}finally{...} with try{}catch(e){...;throw e;} –  ratchet freak Oct 1 '14 at 18:39
3  
@ratchetfreak It's not that simple. ... is also executed when the try block is left via any other means: continue, break, return, and whatever other control flow statements the language offers. Of course there is still a way to replace the finally with other constructs but I think it's far beyond the threshold for syntactic sugar. –  delnan Oct 1 '14 at 19:03

1 Answer 1

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.