On Mon, Nov 29, 2010 at 6:28 AM, Petr Gladkikh <petrg...@gmail.com> wrote: > On Mon, Nov 29, 2010 at 3:29 PM, Ken Wesson <kwess...@gmail.com> wrote: >> In Java, you often have to pair things, e.g. opening a file and >> closing it, to avoid leaking resources like file handles. >> >> These pairings are among many cases where Java code contains structure >> that you can't extract and reify in your program. > > Well, most things _can_ be reified in Java but resulting code would be > so bloated, cumbersome and often inefficient so I do not try to do > that anymore in Java. That is result of such refactoring only makes > program even worse (here I wrote about my attempts in this direction > http://petrglad.blogspot.com/2010/02/stream-close-template.html).
That's basically what I meant. If you try, at best you end up with crap like final File f = whatever; WithOpen.withOpen( new NullaryFn(){public doIt(){return f.open();}}, new UnaryFn(){public doIt(Object s){return doSomethingWith((Stream)s);}}); -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en