Hi: I've recently discovered Clojure and have loosely followed some of the discussions here. First of all, I think Clojure is a great language, since I also love Lisp, and I feel that the Java platform is the most robust for web development. But I perhaps come from a background a little different that most Clojure fans because in most situations my language of choice is C++. I've therefore thought about how Clojure and C++ can benefit from each other. I actually have two ideas:
First, I've been working on a parsing library for C++ which is actually based on Perl6, in the sense that I try to implement a Perl6- like rule system in C++. I decided to make Clojure the basis of the "output" language for these grammars. In other words, a grammar (a set of name rules) is compiled into a C++ class, with rule names becoming methods. This class exposes a method which takes a given file or string and matches it against its rules. The results of these matches are then presented as Clojure-compatible data structures. If there are Clojure functions or macros matching the rule names, the output could be directly executed. In effect, any structured text for which a grammar has been defined, can be compiled to Clojure code. I think there are several applications for this technology, such as using Clojure for data transfer, and creating a Lisp-like macro system for non-Lisp-like languages. What I'd like to do is use this to create C++ extensions, syntactic shortcuts I can put in C++ code to make it more readable, and as hints for code generators to automate things like serialization, as if C++ had Java-style annotations. This might be a little like GNU's "Melt" project ("Middle End Lisp Translator"), but using Clojure in lieu of Melt's own language, which I think is scheme-like but not compatible. Using Clojure simplifies both portability (Melt is only on Unix etc.) and storing information about source code and compilation-related info in a database. The other thing I've been thinking about is whether a full C++ implementation of Clojure is feasible. I've studied some low-level Clojure implementation classes and I have not seen any prohibitive challenges to porting Clojure to C++ rather as Xronos tried to port it to .Net. Obviously Clojure will not have access to arbitrary C++ classes, but (maybe using the parsing tools I described above), there could be easy-to-use development tools to give C++ classes Clojure- interoperability capabilities. Does anyone know of Clojure features which rely on Java features that would be prohibitively difficult to implement in C++? Even a restricted subset of Clojure would be helpful: I've actually gotten a fair amount of Clojure code to run as Lisp, with some readtable manipulation, so there's a Lisp-like subset of Clojure which doesn't rely on any Java features to run. While I love Clojure, I think the development tools for Clojure are a little primitive, and I've sensed a little frustration along these lines from some posts here. Members of this group may disagree, but I'm still not sold on Java as an application development language (as opposed to a web development language), and IDEs which run on Java seem a little slower and harder to use than native-compiled one. So a native Clojure IDE might just make Clojure programming a little easier, but there'd obviously have to be a native Clojure runtime. Perhaps if this project is actively promoted or advocated for, there'd be a chance to bring a wider pool of programmers into the Clojure umbrella, those coming from C++ or Lisp or maybe even Arc, Haskell, etc... -- 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