Re:Java 7: Oracle pushes a first version of closures
by sreque on Monday May 31, 2010 @05:54PM
(#1393592)
How in the world do callables replace closures? Closures can have arguments, callables can't. You cannot pass a ruby lambda expecting arguments to Clojure.
[ Parent
| on HN ]
Re:Java 7: Oracle pushes a first version of closures
by technomancy on Thursday June 03, 2010 @01:25PM
(#1401897)
> You cannot pass a ruby lambda expecting arguments to Clojure.
I beg to differ: http://github.com/technomancy/clojure-gem/blob/master/test/t...
Re:Java 7: Oracle pushes a first version of closures
by sreque on Saturday June 05, 2010 @02:52PM
(#1407255)
Have you looked at the source code for that project? It doesn't use callables at all. the orig_commute function, the original commute method on class Ref, gets passed a monkey-patched ruby Proc object that implements the invoke method which takes one argument, a list, containing all of the original ruby arguments. Clojure then most likely calls invoke inside orig_commute through reflection. The end result: a bunch of hackery specific to Ruby and Clojure, something JVM-level closures would help eliminate.
Again, you cannot pass a ruby function expecting arguments to Clojure! What your link shows is that you can, however, send monkey-patched versions of ruby functions that implement clojure-specific calling conventions to clojure. :)