On Sep 9, 6:06 pm, Phil Hagelberg <p...@hagelb.org> wrote:
> On Thu, Sep 9, 2010 at 8:38 AM, Mike Meyer
>
> <mwm-keyword-googlegroups.620...@mired.org> wrote:
> > And two tools - lein and clojure itself.
>
> I'm not sure Clojure should be counted separately since you're not
> installing it yourself.
>
> > So we go from 3, 0, 1 to 6, 4, 2. I'm not sure that qualifies as
> > simple, but at least there's less boilerplate for the tools than there
> > is actual source code.
>
> Really I think your complaint boils down to not being able to modify
> the classpath at runtime. If the JVM had a real load-path like other
> lisps offer then this would be enough:
>
> (use 'ring.adapter.jetty 'ring.util.response)
> (run-jetty (constantly (response "hello world"))
>                {:port 8080 :join? false})
>
> ...and we're back to three lines.
>
> Now I'm not defending the fact that the classpath is fixed at
> JVM-launch time--it's an awful hack that is an embarrassment to the
> awesome engineering prowess that has gone in to other parts of the
> JVM. But we do have tools to work around that flaw, and it's good to
> recognize the root of the problem rather than its symptoms.

Except the classpath is *not* fixed at all! The concept of classpath
does not exist inside the JVM. Classloaders do. Classloaders are
objects like any other - you can create new instances of them, and
alter their state. Classpath is just an environment variable / command-
line argument to "java", used to conveniently initialize the system
classloader from the outside world. In fact, many JVM-based dynamic
languages allow the "classpath" to be changed at runtime. I know for
sure BeanShell does, and ABCL does too - I contributed the patch to
it.

As for the OP's quest for simplicity - I agree that often things are
overly complicated in the Java world. However, I think that comparing
Apache's cgi-bin with .war packaged applications is unfair, since they
do have different goals. If you want the same "drop file in
diredirectoryctory and be done with it" experience, follow these
steps:

1) download Tomcat and unzip it in $tomcat
2) put clojure.jar is $tomcat/webapps/ROOT/WEB-INF/lib

this installs the server. Then, for each "application", put a .jsp
file in $tomcat/webapps/ROOT containing:

<% out.print(clojure.lang.RT.eval("(foo bar baz)")); %>

(or whatever the right incantation is to eval from Java). done. Browse
http://localhost:8080/scriptName.jsp to run it. Of course, I'd NOT
recommend this, but you seem to know what you want.

Cheers,
Alessio

-- 
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

Reply via email to