News for hackers. Stuff that matters.
Re:Clojure Obscura by MatthewPhillips on Thursday July 12, 2012 @12:37PM (#4235381)
Good to see the compilation target list is growing. The Clojure->Scheme->C target has previously been discussed on HN, sad to see it isn't being actively worked on now. The Clojure->C target is new to me though, and is active. The documentation is a bit light and I can't gleam how to use it from the tests. Has anyone here played with it and know what's going on?

https://github.com/schani/clojurec

Re:Clojure Obscura by werg on Thursday July 12, 2012 @01:04PM (#4235476)
Re:Clojure Obscura by spenrose on Thursday July 12, 2012 @02:44PM (#4236006)
Thanks for this: very interested to hear how live an issue it was that many more platforms supported C than LLVM.
Re:Clojure Obscura by MatthewPhillips on Thursday July 12, 2012 @01:31PM (#4235587)
Wow, his personal goals are exactly the type of thing I've been wanting. Will definitely follow this project.
Re:Clojure Obscura by aaronblohowiak on Thursday July 12, 2012 @01:25PM (#4235561)
What is it about Clojure that makes implementation towards other targets so appealing / approachable to devs?
Re:Clojure Obscura by spacemanaki on Thursday July 12, 2012 @03:00PM (#4236080)
At least some of the recent Clojure implementations are based on ClojureScript's compiler, which from what I understand is relatively moduler: http://blog.fogus.me/2012/03/27/compiling-clojure-to-javascr...

Lisps in general are appealing to implement. Clojure's core language is about as small as Scheme's, and there are a lot of Scheme implementations too. The parts of Clojure that set it apart from other Lisps (STM, persistent data structures) aren't always ported. I don't think any of the recent approaches to targeting C (Clj->Scheme->C, Clj->C) include STM or persistent data structures. I'd be happy to be pleasantly surprised though.

Re:Clojure Obscura by abp on Thursday July 12, 2012 @05:31PM (#4236964)
persistent data structures are implemented in ClojureScript. So they don't need to be ported for new compilation targets of ClojureScript like C in clojurec, I think.
Re:Clojure Obscura by dustingetz on Thursday July 12, 2012 @06:03PM (#4237100)
ClojureScript's core library has a dependency on Google Closure, and are optimized with knowledge of javascript vms. david nolen said that v8, for example, is blazingly fast at sequential instructions so they take great care to avoid function calls in critical paths.

here's some discussion that alludes to performance concerns in js vms: http://dev.clojure.org/jira/browse/CLJS-284

here's the original commit for PersistentVector, note how low level the code is: https://github.com/clojure/clojurescript/commit/e615f4cd326e...

here's more discusson by david nolen: https://groups.google.com/forum/?fromgroups#!searchin/clojur...

more discussion about allowing low level code access to js-specific special forms for numerics: https://groups.google.com/forum/?fromgroups#!searchin/clojur...

Re:Clojure Obscura by MatthewPhillips on Thursday July 12, 2012 @01:41PM (#4235638)
Clojure was specifically designed to have multiple target implementations. That's the why it's approachable. As for why it's desirable, clojure is a high-level language and as such has certain niceties that are difficult to give up when forced to drop down to a lower level.
Re:Clojure Obscura by dustingetz on Thursday July 12, 2012 @05:46PM (#4237043)
its clean and simple. the ClojureScript compiler is 2000 lines of clojure.