Oops, s/create an instead/create an instance/
:) On Mon, Aug 23, 2010 at 10:03 AM, Allen Johnson <akjohnso...@gmail.com> wrote: >> (:1 Should the clojure source files intermingle with the java source files, >> each according to it's relavance to the problem, or should there be a top >> level separation between them?) > > IMO, they should be separated. Since the project was started with Java > I'd continue treating it as the top-level. > >> (:2 Say I have this: >> English.java --- which defines some cool data structure >> representing English sentences >> Chinese.java --- same as above except for Chinese. >> awesome-junk.clj --- which provides unthinkably cool AI functions >> that map English objects to Chinese objects. This is AOT compiled so >> other things can use it. >> PainstakinglyMadeGUI.java --- which provides an awesome GUI that >> uses the English and Chinese objects and calls the functions provided >> by awesome-junk. >> >> Now, how can I build this project from nothing!? > > In the Java sources you can provide one or more java interfaces that > describe the call contracts for awesome-junk.clj (IAwesomeJunk). All > your Java code will depend on this interface and can be built first. > > Then you implement that interface in Clojure using gen-class or > deftype/defrecord - which ever suits your needs best. These Clojure > sources are built second and depend on the generated class files from > your Java sources. > > Now at runtime, you can create an instead of the Clojure > implementation of IAwesomeJunk and pass that to the Java classes that > depend on it's functionality. A dependency injection framework makes > this pretty simple but might be too heavy for what you need. > > So to summarize, IMO your build would have the following phases: > > 1. Compile Java Sources > 2. Compile Clojure Sources (with step 1's classes available) > > You probably have even more options with defprotocol but I am not > familiar enough. > -- 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