Hacker News new | past | comments | ask | show | jobs | submit login

"t's no worse than PYTHONPATH or GEM_PATH, and far more self-contained by default."

Yes it is worse. ruby is far easier to start with.

  $ gem install json
  $ irb
  ruby-1.9.1-p378 > require 'rubygems'
   => false 
  ruby-1.9.1-p378 > require 'json'
   => true 
  ruby-1.9.1-p378 > JSON.parse({'1' => '2'}.to_json)
   => {"1"=>"2"}



    $ lein new myproj
    Created new project in: myproj
    $ cd myproj
    $ lein deps
     [copy] Copying 2 files to myproj/lib
    $ lein repl
    Clojure 1.1.0
    user=> (use 'clojure.contrib.json.read 'clojure.contrib.json.write)
    nil
    user=> (read-json (json-str {"1" "2"}))
    {"1" "2"}
I admit I cheated a bit: clojure-contrib comes with a JSON parser, and lein automatically includes a dependency on clojure-contrib. If I needed a different library, I'd have edited project.clj to include the dependency.


You cheated in two ways. Ruby Gems comes with every version of ruby I've ever used. If I go to the clojure site where does it mention lein? How do I add another lib? Here's the ruby site on this topic, which is linked from the top of almost every page on the site.

http://www.ruby-lang.org/en/libraries/

It's amazing that you get voted up when you are clearly avoiding my point. Show an example without cheating! What if I wanted to talk to mysql instead of using json. My ruby example would be the same. gem instal ...; irb; require; use it


How do I add another lib? ... Show an example without cheating!

It's amazing that you get voted up when you clearly did not read my post. I wrote: "If I needed a different library, I'd have edited project.clj to include the dependency." Let me explain that in detail:

lein generates the following default project.clj:

    (defproject myproj "1.0.0-SNAPSHOT"
      :dependencies [[org.clojure/clojure "1.1.0"]
                     [org.clojure/clojure-contrib "1.1.0"]])
Then you change it to:

    (defproject myproj "1.0.0-SNAPSHOT"
      :dependencies [[org.clojure/clojure "1.1.0"]
                     [org.clojure/clojure-contrib "1.1.0"]
                     [mysql/mysql-connector-java "5.1.13"]])
To wit: you add a dependency by including it in the :dependencies vector. For example, Berkeley DB JE would be [com.sleepycat/je "4.0.92"]. Then you run "lein deps", which takes care of the rest.

I hope you aren't arguing that editing a text file to include a dependency is too difficult, so I'll address your other point: the Clojure site does not mention Leiningen. There's actually a good reason for it: it is not a core necessity for using the language; you don't have to use Leiningen to use Clojure. If you understand the classpath, you don't really need it. Leiningen is a convenience, not a necessity of life.

I'll readily agree that an overview of available development aids would make for a nice addition to clojure.org. No definitive "Beginner's Guide to Programming in Clojure" exists. It would ideally explain how to get started at the REPL, how to use SLIME and swank-clojure to work with Emacs, and how to use VimClojure to work with vi, how to handle packaging, and how to deal with dependencies. It would also explain why and how someone might want to use Ant, Maven, Ivy, Leiningen, and the clojars.org repository. I'm sure that someone will write this guide some day soon.


This still assumes a lot. It assumes the lib is in a maven rep, it assumes use of lien which isn't standard like gems at this point, and let's be honest, maven is a beast compared to gems.

You said that clojure is as easy as ruby for a noob. The simple fact is that it isn't, and you've essentially admitted as much.


You don't read my posts, but you're getting upvotes, and this story still has traction on HN. I apologize for continuing this discussion, but you are spreading FUD, and some people might getting the wrong impression.

It assumes the lib is in a maven rep

Gems assumes that the gem is available in a Gem repository. I see no practical difference.

it assumes use of lien [sic]

"rubygems" is a separate package from MRI in Ubuntu. Standard or not, you have to install it. You also have to install Leiningen. With time, Leiningen or a tool like it will become a de-facto standard. Your original post strongly implied that no good tools exist for Clojure package management. This is false, and I refuted this claim.

maven is a beast

Yes. I wrote that in my original post; I'm glad you at least read that part. Leiningen uses Maven repositories and dependency resolution under the hood, yes. My example, however, does not use Maven at all. Most projects which use Leiningen to manage dependencies do not need to worry about Maven's intricacies at all.

You said that clojure is as easy as ruby for a noob.

Nowhere in any post did I say that Clojure the language is as easy as Ruby. That would have been a meaningless statement.

I actually said that the Java classpath is no worse that PYTHONPATH or GEM_PATH. I meant exactly that. Dependency path management sucks in every environment I've ever seen. I said nothing at all about the Gem toolchain, or how well it helps mitigate the problem. It certainly has had several years to mature. That said, six month-old Leiningen is decently close to the simplicity that Gems provides.


me: "It assumes the lib is in a maven rep" you: "Gems assumes that the gem is available in a Gem repository. I see no practical difference."

Hm, I can't figure you out. Your statement is missing the point. I don't know if you see that point and are cherry picking on purpose or if you don't know both ecosystems. I've done a lot of ruby, a lot of java, and a fair amount of clojure. I frequently run into very common java libs that are not in a maven repo. It's a common occurrence. I can't think of any significant ruby lib that isn't in a gem repo. The two situations are not equivalent.

"Nowhere in any post did I say that Clojure the language is as easy as Ruby."

Again, this is literally correct, but I feel you've implied it. You're like the Karl Rove of comp sci. The original comment was complaining that the clojure noob experience appeared painful. You then said that the java classpath was no worse than gem_path.

This is both wrong (the need for class loaders is one example of why, and my highlighting of the ease of use of gems is another), but it's also clearly implying that using libs in clojure is as easy for a noob as it is in ruby land. You can claim that you weren't implying that, but if that's the case then your reply was meaningless. Again, this is Karl Rove style hair splitting on your part.

Let me be clear then. The noob experience in ruby is much better than in clojure. Do you disagree? I've taken your statements as implying that, but you claim to have never said it explicitly, so now I'm asking you outright.


Wow, someone needs to calm down. Stop calling people Karl Rove because they aren't seeing the same argument you are. Maybe it's deliberate, maybe it's not, in either case the accusation looks foolish.

After using both, the noob experience in Ruby is better than in Clojure. I've had cases where more "advanced" library/package management was easier in Clojure (really, Maven) due to system local vs. project local package lookup. It's entirely possible that says more about my knowledge on the subject than anything else.


If someone accuses me of spreading FUD, while they are intentionally cherry picking at best, then I'm going to respond. It's my nature to respond to personal attacks against me.

Oddly you don't find him foolish for the FUD comment, just me for responding to it.


When Ruby was the same age as Clojure I don't think it was as easy as using RubyGems - the first time I became aware of RubyGems was when this new fangled Rails thing started!


The main difference is that you can modify your $LOAD_PATH at runtime in Ruby, while on the JVM it's fixed at startup.

This is particularly ironic because it's a cultural norm in the Ruby community to launch lots and lots of short-lived ruby processes to run your tests, while in Lisp-land it's much more common to have very long-running repl sessions with uptimes often lasting in the days range.


The CLASSPATH can be modified at runtime by writing custom class loaders. It isn't trivial, but it is possible. I had to do it to implement Hierarchy:

http://www.whitemagicsoftware.com/software/java/hierarchy/


You could put a temporary directory on your class path, and then unzip any jars into it. You could then reload Clojure source files, although I'm not sure if you'd be able to do anything about Java class files without a custom class loader.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: