Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-30 Thread Luke VanderHart
Robert, The only problem with this approach is that there ARE practically guaranteed to be circular references. If the goal is to "compile Clojure as if it were Java", circular references must be accounted for. But dependencies on classes generated based on parsing bytecode... that seems a pretty

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-30 Thread Matt Fowles
All~ There was a presentation at the JVM language summit about this exact topic. http://wiki.jvmlangsummit.com/Mixed_language_project_compilation_in_Eclipse:_Java_and_Groovy In fact, the person was look

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-29 Thread Robert McIntyre
I don't think two pases is enough. What if a clojure file uses reflection (with macros of course) on a compiled java file to generate classes, sort of like how lancet works but generating classes instead of functions? And then those classes are used from other clojure and java files. Oh, and the

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-29 Thread Meikel Brandmeyer
Hi, Am 28.08.2010 um 19:09 schrieb Michał Marczyk: > I'm sure I'm missing lots of things, but I'd love to know which, so -- > please let me know. :-) In fact, your two-pass scenario is probably the best you can get, since you can define arbitrary classes in arbitrary namespaces. (Whether this i

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-29 Thread Robert McIntyre
Has anyone actually implemented this sort of placeholder strategy before? --Robert McIntyre On Sat, Aug 28, 2010 at 3:04 PM, Michael Wood wrote: > On 28 August 2010 19:27, Michał Marczyk wrote: >> On 28 August 2010 19:19, Luke VanderHart wrote: >>> I'm not just talking about class hierarchy de

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Luke VanderHart
Hm, thanks for the reference to that groovy thread... an interesting read. I might take a stab at writing a *generate-stubs* patch to Clojure's compiler, just to see how hard it would be to do. Out of curiosity, if Rich or anyone on the dev team reads this, is this the sort of thing that might po

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Seth
This sounds very similar to groovyc: http://groovyland.wordpress.com/2009/03/03/groovyscalajava/ On Aug 28, 12:50 pm, Luke VanderHart wrote: > For the past week or two, I've been investigating what it would take > to write something that would allow *.clj  and *.java files to > seamlessly compil

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Michael Wood
On 28 August 2010 19:27, Michał Marczyk wrote: > On 28 August 2010 19:19, Luke VanderHart wrote: >> I'm not just talking about class hierarchy dependencies, but also >> reference dependencies. > > Ah, I see. In that case, maybe generate placeholders for all the > classes to be implemented in Cloj

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Michał Marczyk
On 28 August 2010 19:19, Luke VanderHart wrote: > I'm not just talking about class hierarchy dependencies, but also > reference dependencies. Ah, I see. In that case, maybe generate placeholders for all the classes to be implemented in Clojure (with all methods doing something like "throw new Run

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Michał Marczyk
Oh, I also think that mixing and matching Clojure & Java "modules" -- groups of namespaces / classes which would be share a single build artifact -- is already fairly simple, whereas I'm not sure if mixing and matching at the level of individual source files -- with dependency chains like "foo.java

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Luke VanderHart
I'm not just talking about class hierarchy dependencies, but also reference dependencies. For example: Foo.java class Foo { public Bar getBar() {...} } Bar.java class Bar{ public Foo getFoo() {...} } This is pretty common in the Java world. What I'd like to do is have Foo be written in

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Peter Schuller
What is the primary goal you're trying to achieve? Specifically, something that is not addressed by e.g. a maven project with both clojure and java source (which works seamlessly out of the box)? I realize it's not the same thing; perhaps you're after making a single compiler invocation for perfo

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Michał Marczyk
Providing we're happy with disallowing circular dependencies (which is what javac and clojure.lang.Compiler do anyway), I wonder if it might be possible to have a build tool invoke the appropriate compilers on a file-by-file basis, so that if foo.java depends on a class generated by bar.clj, which

Re: Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Luke VanderHart
My apologies, the title got cut off. It should be: "Is it possible in theory to write/modify a Clojure compiler that doesn't resolve Java references?" On Aug 28, 12:50 pm, Luke VanderHart wrote: > For the past week or two, I've been investigating what it would take &g

Is it possible in theory to write/modify a Clojure compiler that doesn't

2010-08-28 Thread Luke VanderHart
For the past week or two, I've been investigating what it would take to write something that would allow *.clj and *.java files to seamlessly compile together, such that they could be freely intermixed in a project. I knew it was a difficult problem, but I think the adoption benefits would be subs