Hi, On SO recently, someone asked how to generate a varargs method with gen-class [1]
i.e how can the equivalent of this method be generated: void foo(String... args) { ...} I did some investigation into a possible answer. Thinking that varargs methods in java are a trick of the compiler I expected to be able to generate void foo(String[] args) {...} with this... (ns foo (:gen-class :name Foo :methods [[foo ["[Ljava.lang.String;"] void]] )) and for it to 'just work'(tm). decompiling the generated class I get... $ javap -classpath . Foo public class Foo extends java.lang.Object{ public static {}; public Foo(); public java.lang.Object clone(); public int hashCode(); public java.lang.String toString(); public boolean equals(java.lang.Object); public void foo(java.lang.String[]); public static void main(java.lang.String[]); } The problem is that the foo method is not recognized as a varargs method if you compile against it. After some digging I discovered that for a method to be recognized as a varargs, the ACC_VARARGS flag must be on the method in the bytecode. In the clojure-1.4.0 src I found that the flag is defined in ./src/jvm/clojure/asm/Opcodes.java but is never referenced anywhere, which leads me to the conclusion that currently it isn't possible to generate a varargs method in clojure. Am I missing something? Should I raise this as an issue on JIRA? [1] http://stackoverflow.com/q/10414075/808653 Neale {t: @sw1nn <https://twitter.com/#!/sw1nn>, w: sw1nn.com } -- 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