I was reading on Erjang implementation, and in an article<http://www.javalimit.com/2009/12/tail-recursion-in-erjang.html> <http://www.javalimit.com/2009/12/tail-recursion-in-erjang.html>about how it handles recursion, the author says this about multi-arity functions:
- Every function is compiled to a class *F* with one method named *body**(EProc proc, EObject arg1, ... EObject argN)*. The function takes the EProc (a reference to the light-weight process) and the N arguments. The class *F* is marked final. This function contains the result of compiling an Erlang function into Java. - If the function takes *2* arguments then *F* is a subclass of class EFun*2*, a class provided by Erjang. *Erjang has a class loader that triggers when such a class is missing and generates EFun**N classes on the fly.* - From the generated superclass, class *F* inherits the virtual methods *invoke(EProc proc, EObject arg1, ... EObject argN)* and *go(EProc proc)*. Recently there was a great discussion on how Clojure could better handle primitive types, and it was noticed that combinatorial explosion is a major limitation do to primitive interfaces declaration<https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java#L91>, and that this could only be solved by ClojureInClojure. Why can't we use a custom ClassLoader that generates the needed interface when asked? I noticed that Clojure goes until 20 arguments, and then expects Object... for the 21st invoke. Does this solve the limitation? Scala is limited to 22 arguments per function, but I didn't understand the explanation<http://stackoverflow.com/questions/4152223/why-are-scala-functions-limited-to-22-parameters>about two customly generated classes being of different types. Couldn't these problems be solved by a custom ClassLoader as well? (Of course, I don't think anybody should write a 20+ argument function, but you know, we're a bunch of misfits that enjoy having the freedom to do as we please...) Thanks for your attention, Bruno Kim. -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.