Trouble specifying a gen-class constructor taking an argument of the class being created
Hello, Does anyone know a straightforward way to create a constructor using gen-class that takes an argument of the same class as the class you're generating? When I try to do it I get a ClassNotFoundException, assuming I don't have a previous compiled version of the class in my compile path. Basically what I'm trying to do is: (ns my.class (:gen-class :init init :constructors {[String String] [] [some.java.Class] [] [my.class] []} :state state) (:import [stuff.goes.here])) (implementation) I could just instruct the constructor to take an Object, but that's not satisfying and forces me to branch more in -init to determine the class of the argument. On a different note, is there a capitalization convention for classes created with gen-class? Is it CamelCase since they're java classes for all intents and purposes? Or hyphen-case since we want to spread the love? Thanks, Garth --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Trouble specifying a gen-class constructor taking an argument of the class being created
Does anyone know a straightforward way to create a constructor using gen-class that takes an argument of the same class as the class you're generating? I've actually hit a related problem: a generated class cannot have type annotations for itself (because, as you've noticed, the class doesn't exist yet), and thus ends up using reflection when calling its own inherited methods. I end up annotating the 'this' argument with the superclass name, but of course that's not strictly correct. On a different note, is there a capitalization convention for classes created with gen-class? Is it CamelCase since they're java classes for all intents and purposes? Or hyphen-case since we want to spread the love? I use PascalCase. (camelCase is where there's a hump in the middle.) ;) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Trouble specifying a gen-class constructor taking an argument of the class being created
On Wed, Jul 8, 2009 at 7:57 AM, Garth Sheldon-Coulsong...@mit.edu wrote: Hello, Does anyone know a straightforward way to create a constructor using gen-class that takes an argument of the same class as the class you're generating? I think what you're describing is: http://www.assembla.com/spaces/clojure/tickets/84 --Chouser --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Trouble specifying a gen-class constructor taking an argument of the class being created
I think you're right. Thanks. At this point I'll just work around it rather than patching, but it's good to know people are thinking about it---even if Rich has set the ticket to Backlog. And thanks Richard... I didn't even know PascalCase had a name =). On Wed, Jul 8, 2009 at 2:00 PM, Chouser chou...@gmail.com wrote: On Wed, Jul 8, 2009 at 7:57 AM, Garth Sheldon-Coulsong...@mit.edu wrote: Hello, Does anyone know a straightforward way to create a constructor using gen-class that takes an argument of the same class as the class you're generating? I think what you're describing is: http://www.assembla.com/spaces/clojure/tickets/84 --Chouser --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---