>>25
You can do that in CL, which is a multi-paradigm programming language (allows functional programming too). you have macros like WITH-OPEN-FILE and other WITH-* macros, they take care of opening and closing the file for you, or in more general terms, they allocate the resource when you enter the context of that block of code and de-allocate it when you exit it. This is done by using UNWIND-PROTECT under the hood, which is similar to try{}finally{} in Java/Sepples, but such details are hidden/abstracted away for you by the macro.