I've been thinking about clojure support as well, and there are a few
issues that it would need to address (many of which have already been
mentioned by others):
* Since clojure has a static runtime, support for multiple independent
runtimes in the same JVM can be challenging. To support this, the lang
module would need to implement VerticleFactory in Java, and add the
clojure jar to the classloader for each individual verticle created in
createVerticle(). The verticle would likely need to be wrapped in a
shim class that exposes enough of the clojure API to act as an entry
point without exposing any clojure classes outside of the verticle's
classloader. I'm basing this on experience writing the runtime
isolation code for Immutant.
* Good leiningen integration is important - a lein-vertx plugin not only
needs to run the project in vertx, but would also need:
* a task to package the project as a module zip
* a mechanism to transfer a list of the project dependencies to vertx
* a configurable main ns, with maybe a sensible default?
* a mechanism for setting arbitrary configuration that passes through
to the verticle
* The lang module would need a built-in repl, probably by depending on
nrepl, and providing a config option to start it when a verticle is
created.
* Ring-like http support would be needed, but this could probably be
provided by another module that sits on top of the lang
module. http-kit may serve as a good model for this; I haven't looked.
* In addition to good verticle/module support, the lang module would
need to work well when embedded. I don't see that as being too
difficult.
I plan on starting on the runtime isolation issue this week, and am
willing to devote significant time to a solid clojure lang module. Once
I get the isolation piece worked out, I'll share what I have and we can
work together on coalescing the bits and pieces that are floating around
into something that can become an official lang module.
- Toby
stream writes:
> Hi.
>
> I hava spent part time to clojure, and make some test,
> i refer two project vertx-clj and vertx-mod-lang-clojure, both could be found in github.
> it could work on the REPL with clojure code.
> but they are still two things need to be done.
>
> 1. a lein plugin for dev clojure with vertx. (which like lein-ring)
>
> 2. implement ring adapter with vertx HttpServer (we could use a lot of lib with ring middleware)
>
> i will do my best to make it work fine, hope this would be done in July...
>
>
>
>
>
> On 2013年6月13日, at 上午7:44, Nathan Frund <
nathan...@gmail.com> wrote:
>
>> On Wednesday, June 12, 2013 4:50:26 AM UTC-4, Bruno Bonacci wrote:
>>
>> Since Clojure has got a very strong idiomatic code and way of working (REPL),
>> a simple "wrapper" wouldn't be enough. The few line of Clojure-Vertx sample I've seen they don't look like Clojure idiomatic code,
>> but more like calling Java API from Clojure.
>>
>> I think we should do like the Scala guys and join forces in the Clojure space.
>>
>>
>> The REPL is huge when doing Clojure dev.
>>
>> When googling around I found lein-vertx:
>>
https://github.com/isaiah/lein-vertx
>>
>>
>> And the accompanying project - Vertex-clj:
>>
https://github.com/isaiah/vertx-clj
>>
>> I gave the projects a quick spin but didn't get very far.
>>
>> I'm still evaluating Vertx for a project but the decision would be made easier if I could jump in with Clojure.
--
Toby Crawley
http://immutant.org |
http://torquebox.org