5 ms·
Clojure implemented on top of Python
- videoappeal 15y agoIf complaining about the startup times of JVM then i believe a solution exists laready i.e. ClojureScript running on top of Node.Js be a better fit?
- regularfry 15y agoPython is preinstalled on a lot of platforms. That might be relevant.
- masklinn 15y ago> i believe [...] ClojureScript running on top of Node.Js be a better fit? Why? Python is likely to be installed in far more environment than Node, and for scripting, Clj on top of Python provides the faster startup of Python interpreters without the callback spaghetti inherent to Node. Because even if Clojure(Script) handles functions better than Javascript (both in verbosity — fns are no more verbose than lets — and in its scoping handling) it's still callback spaghetti.
- videoappeal 15y agoWhy ClojureScript? because it is much closer to feature complete, tested, supported by the core team yada yada
- masklinn 15y ago> Why ClojureScript? No, why is clojurescript a better fit (than clojure, running on Python)
- nathell 15y agoAn insane idea: run this on top of CLPython on top of ABCL on top of the JVM.
- mattdeboard 15y agoYeah and let's get it to compile down to XML!
- bwarp 15y agoI wouldn't even go there. I worked on an ecommerce project in the early 00's which compiled a high level turing complete DSL (not that far from LISP TBH) to XML and then used a virtual machine written in Java to run the XML. I've never seen a language in which the compiler output was 2 orders of magnitude larger than the source code. I really don't know how anyone came to the conclusion that any of that was a good idea. I still have nightmares about that.
- lmm 15y ago>I've never seen a language in which the compiler output was 2 orders of magnitude larger than the source code. Ever used SWIG, or qt designer, or anything else that compiles to a source code format? (heck, I can only assume most of those languages-that-compile-to-javascript must be similar) (not that that makes your project any less bad)
- Lazare 15y agoI know it's irrational, but I tend to avoid JVM languages after some bad past experiences. (Yes, I know, Java is great, and the JVM is vastly improved! I said it's irrational.) On the other hand, I've been wanting to learn Clojure. It'd be nice to see this project mature.
- lclarkmichalek 15y agoWell the aim of this project seems to be to avoid the start up time of the JVM so clojure can be used for scripting.
- fceccon 15y agoYou can use Clojurescript on top of Node.js to achieve that. I never tried it so I don't have first hand experience. https://github.com/clojure/clojurescript/wiki https://github.com/clojure/clojurescript/wiki
- cabalamat 15y agoAnd also to "make use of [Python's] extensive, 'batteries included' libraries" That's what seems the real benefit of it to me. Maybe Python will become not just a language, but a platform, like JVM or CLR, supporting multiple languages.
- kaonashi 15y agoHow does it accomplish that better than say, clojurescript+node?
- darklajid 15y agoI guess .Net [1] is no option either? Not sure if that stuff works on top of mono as well.. 1: https://github.com/clojure/clojure-clr https://github.com/clojure/clojure-clr
- ericmoritz 15y agoI have that same irrational feeling about the JVM, I'll say this, go ahead and learn Clojure; it only slightly smells like the JVM.
- djhworld 15y agoInitially when I first saw this I thought "nice but...really?" then I read the blurb about writing scripts/automating system tasks and remembered the pain of the JVM startup. Will definitely be keeping an eye on this.
- andrewcooke 15y agohow does it implement clojure's lazy sequences? does it manage to map them to generators?
- irahul 15y agoFrom a cursory glance at https://github.com/eigenhombre/PyClojure/blob/master/core.py https://github.com/eigenhombre/PyClojure/blob/master/core.py it doesn't do anything with the lists yet, other than having a list class which stores the values. As far as lazy goes, how does clojure does it? Thunks? The implementer can opt for thunks or generators(doesn't generator serve as an higher level abstraction to manually "thunk and force") as far as Python implementation goes.
- andrewcooke 15y agoi have no idea how clojure is implemented, but i guess i always assumed that they were implemented as iterators.
- steele 15y agooh JVM startup time isn't that terrible, but this is cool.
- irahul 15y agoJVM startup time is terrible, compared to the alternatives.
- regularfry 15y agoYes, it is. When I compare red-green-refactor cycles between Ruby and Clojure, and I've got sub-second turnaround in one and 5+seconds in the other, it's painfully bad.
- pavelludiq 15y agoWhy reimplement all of clojure as an interpreter? Why not just rewrite the java parts in python and compile to bytecode? Honest question.
- moonchrome 15y agoActually a better path would have been to hack on the ClojureScript compiler that compiles to JavaScript and fork it to compile to Python, most of the core stuff is implemented with ClojureScript primitives (like seq library, collections, atoms, etc.) so there would be substantially less work starting from there.
- Symmetry 15y agoAre you familiar with PyPy? It was originally just an exercise in implementing Python in Python, but then it was discovered that this led to some very interesting possibilities for JIT compilation, and after a lot of work PyPy is now much faster for most tasks than regular CPython. The thing is, there's nothing about PyPy that says it has to be implementing Python itself, and recently here on Hacker News there was an article where someone was singing the praises PyPy as a way to implement the language he was developing. http://tratt.net/laurie/tech_articles/articles/fast_enough_vms_in_fast_enough_time http://tratt.net/laurie/tech_articles/articles/fast_enough_v... And it seems this person had come to the same realization. EDIT: Oops, rereading I see I misunderstood something the README said, and he is only now considering using PyPy instead of CPython.
- apgwoz 15y agoWhile I appreciate the sentiment, Python isn't exactly the fastest language out there. But, if you have to do it, I'd suggest compiling to the Python AST and emitting bytecode.
- postfuturist 15y agoTo solve the clojure script startup time: http://www.martiansoftware.com/nailgun/ http://www.martiansoftware.com/nailgun/ "Nailgun is a client, protocol, and server for running Java programs from the command line without incurring the JVM startup overhead." I only know about since vimclojure uses it (to good effect, so it obviously works fine with Clojure).
- gtrak 15y agoAlso consider clojurescript on node.js, might be more worth the effort than a python implementation at this point.
- sandGorgon 15y agoI wonder what happened to Shen (http://www.lambdassociates.org/Shen/newappeal.htm http://www.lambdassociates.org/Shen/newappeal.htm). From the blurb, This function set defined a Lisp that was much smaller than Common Lisp, in fact, much more like John McCarthy's Lisp 1.5 which is the distant ancestor of all subsequent Lisps.... I went further and suggested that this small Lisp could probably be mapped into many of the Lisp-like successors to Lisp like Python, Clojure and Javascript. This meant that because Qi was bootstrapped, these mappings could be used port Qi into other platforms" Actually come to think of it, what ever happened to clojure-in-clojure [1] - that would have made implementing clojure on top of any VM, relatively trivial [1] http://blog.n01se.net/?p=41 http://blog.n01se.net/?p=41