7 ms·
A question I've been meaning to ask but didn't want to make a completely new post about it: If you could write a server (not a plain HTTP webapp necessarily) i
by mcav 16y ago
A question I've been meaning to ask but didn't want to make a completely new post about it:
If you could write a server (not a plain HTTP webapp necessarily) in Clojure, Python, or Node.JS, provided you know all three, which would you choose and why?
- francoisdevlin 16y agoI'd go with Clojure if you need any of the following: 1. Concurrency 2. The most (largest qty of) available FOSS libs anywhere 3. Speed 4. The ability to extend the language 5. WORA 6. Text/string processing Python will win in scripting/*NIX integration, though. Don't really know enough about Node.JS
- icey 16y agoNode is pretty interesting and seems to have pretty good performance, but I wouldn't build anything critical on it until at least version 0.2. As far as I know, there are semi-frequent breaking changes. Ryan Dahl has said that API stability should come with version 0.2.
- caffeine 16y ago"I wouldn't build anything critical on it until at least version 0.2" Ha! It's a brave new world. It used to be you needed a whole version number under your belt before critical stuff could be built..
- andrewvc 16y agoAgreed, node development is going at a breakneck pace, but you should count on your code not working 6 months down the line without at least as few tweaks. BTW, the new Buffer objects are awesome, and provide massive speed increases with binary data.
- rglullis 16y agoI really have a hard time seeing Python losing to Clojure on (2), (5) and (6). What kind of software/library would you find on Clojure but not Python? How is Python not WORA? Where does Python lack in text processing?
- francoisdevlin 16y agoJava & the JVM give me 2 & 5. While Pythons text processing is great, I think functional composition & juxtaposition give Clojure and edge. Plus, strings are simply sequences, so the core language works well with them too.
- KirinDave 16y ago> What kind of software/library would you find on Clojure but not Python? Java has a lot of great libraries for which there are not terrific examples in Python. Clojure gets all of them. > Where does Python lack in text processing? Clojure handles large strings better than Python (unless you start using substrings, in which case an underlying java bug hits you). (oh, and Clojure is not a deliberately and comically crippled language).
- rufugee 16y agoHow is Python deliberately and comically crippled? I'm honestly curious.
- hugoc 16y agoI think he may be refering to the GIL.
- KirinDave 16y agoThat and certain deficiencies spawned by a desire for “simplicity.”
- technomancy 16y agoDon't forget one-line lambdas.
- strlen 16y ago> 2. The most (largest qty of) available FOSS libs anywhere Quick heads up. The ease of FFI (in Clojure's case with Java) is not unique to Clojure and it isn't necessarily a great thing. It's also an issue with Common Lisp: as FFI with C is easy, there's less incentive to develop idiomatic libraries for the language. E.g., Common Lisp lacks a standard modern way to network I/O, but it's largely been ignored as larger users of the language e.g., ITA could always build and standardize upon an internal C-based extension. That being said, Clojure is great for reasons beyond running on the JVM: a unique approach to concurrency, incorporation of ML-family features, first order data structures beyond lists (maps, vectors) and the fact it's a Lisp-1 with a great macro facility. I'd love to see Clojure also go beyond the JVM and onto CLR, Parrot and LLVM. Interestingly enough the other prominent "next generation Lisp", arc, is also a Lisp-1 with true macros (as opposed to Scheme's hygienic macros).
- prospero 16y agoIt's very common to write an idiomatic wrapper for a useful Java library. Your complaint seems to be that those wrappers won't survive the transition onto another platform. I don't really see why that's a problem. Why target another platform if not for its libraries? If Clojure is exactly the same on the JVM as it is on LLVM, why should it ever leave the JVM?
- mahmud 16y agoCommon Lisp lacks a standard modern way to network I/O http://common-lisp.net/project/usocket/ http://common-lisp.net/project/usocket/
- draegtun 16y agoThe most (largest qty of) available FOSS libs anywhere Do you literally mean anywhere or compared to other GAE languages? If so do you have a rough estimate on how many Java/Clojure FOSS libraries/modules/packages there are?
- mattculbreth 16y agoI actually did this purely for fun. Could have done Python but I've been meaning to learn Clojure anyway. Check out http://github.com/mattc58/animate http://github.com/mattc58/animate for the beginning of my web server in Clojure.
- jacquesm 16y agoSuper, thanks! I've asked if there was some kind of a reference web application in clojure that I could study before to show me 'how it's done', but got no takers, so I'll use your code as a study object if you're ok with that.
- mattculbreth 16y agoSure absolutely. It's been a good learning experience. As soon as I finish the blogging features of it I'll start blogging about it. :)
- jacquesm 16y agoThis is something I've been noticing as long as I've been prorgramming. If you are programming a tool then the tool will be a requirement for building the tool. For instance, you can't really build an assembler for a new architecture from scratch without some form of assembler and so on. The bootstrapping sequence seems to be endless, you could be blogging about writing your blogging tool if you had it already. We always seem to need some scaffolding underneath it, just one more turtle on the stack. No more hand calculating branches these days, /me is happy ;)
- mattculbreth 16y agoThis is all for fun and for great justice, so I'm cool reinventing the wheel.
- weavejester 16y agoMark McGranaghan's Ring library might be a good place to start. The Ring spec is the de facto base library for web applications in Clojure, much as Servlets are in Java, and Rack is in Ruby.
- kixxauth 16y agoKeep in mind the loading request scenario for running GAE apps that are implemented on the JVM. http://code.google.com/appengine/kb/java.html#What_Is_A_Loading_Request http://code.google.com/appengine/kb/java.html#What_Is_A_Load...