Hacker News new | past | comments | ask | show | jobs | submit login
Clojure for .NET (github.com/richhickey)
57 points by DrJokepu on Feb 11, 2010 | hide | past | favorite | 12 comments



.NET has tail call optimization. Does clojure clr implement support for it?


I can't be bothered to download and run reflector on it but if they made it completely in C# then I don't see how they could have taken advantage of TCO since the compiler doesn't ever make use that CLR instruction.


As far as I can see Clojure CLR uses the Dynamic Language Runtime and Expression Trees which do support tail recursion. I don't know if Clojure CLR takes advantage of it, probably not. However, recent .NET VMs automatically apply tail-recursion optimization if a number of specific conditions are met, even if the compiler doesn't actually emit tail-recursive IL.


I think you are confusing the clojure compiler and the clojure language compiler.


Presumably the Clojure compiler emits MSIL. You can emit whatever instructions you want, even if the host language's compiler doesn't emit those instructions.


Another (inactive) project that I found interesting:

http://dotlisp.sourceforge.net/dotlisp.htm


This is actually the precursor to Clojure; note how it was developed by Rich Hickey.


Yeah, there are a variety of lisp-y things out there for .NET, I came across this one quite by accident and was surprised to see the name. I read that Hickey had originally thought to target the CLR with Clojure, when I found this project I wondered if this is what he was talking about.


BTW for "inactive" read "stable" :-) I have updated my personal build a bit, but haven't had time to add my changes back to SourceForge. Mark Hurd markhurd@ozemail.com.au


I've been toying with the idea of creating a LLVM-based Clojure implementation, which would permit interesting constructs such as coroutines and continuations. Too busy though, and Java 7 will supposedly support them, if it's ever released.


This idea has been bounced around by a few people interested in getting Clojure onto the iPhone/iPad platform too, since the JVM is unlikely to ever be there.

MacRuby suggests that it's not a complete pipedream, but the experience of the Unladen Swallow team indicates that it will not be all unicorns & rainbows. You'd also have to find an appropriate GC (I know some people are looking at using Boehm to get MacRuby on iPhone, but you have to wonder if you'll run afoul of the Appstore Police by incorporating a GC in your app.)


Stuff like this is why I'm convinced the PyPy guys have the right approach. Write it once in a high level language and then compile it into different targets.




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

Search: