That's a clever trick. How does the block know which interface method was invoked? -SS
On Aug 31, 2:41 pm, rb <raphi...@gmail.com> wrote: > Hi, > > After using Jwt from Clojure, I did it with Jruby and discovered that > Jruby has what they call Closure Conversion (http://kenai.com/projects/ > jruby/pages/CallingJavaFromJRuby#Closure_conversion ) where a Ruby > block or closure is converted to an appropriate Java interface. From > the wiki: "When calling a method that expects an interface, JRuby > checks if a block is passed and automatically converts the block to an > object implementing the interface". > > I found this to be unbelievably easy to use and efficient (for the > developer) as the listener is added this way: > button.clicked.add_listener(self) do > greeting_.setText(nameEdit_.getText) > end > > There's no need for the developer to implement any interface or manage > any proxy object. > I wondered if something similar is possible in Clojure. If not, would > this be considered a valuable addition to Clojure? > > Thanks > > Raphaël --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---