CLR questions

40 views
Skip to first unread message

tsuraan

unread,
Sep 22, 2010, 4:06:45 PM9/22/10
to clojure
I have two (apparently unrelated) questions about ClojureCLR.

First, does Clojure 1.2 build under mono? The clojure-clr tree only
appears to have a .sln file; is there some sane way to convert that to
a Makefile or a shell script that can be used under *nix?

Secondly, has anybody tried deploying a clojure-based app under XNA
(the XBox API)? I've seen some basic howtos for F#-based XNA
development; I'd be interested in hearing about anybody's experience
doing this with Clojure.

Thanks for any input.

Timothy Baldridge

unread,
Sep 22, 2010, 4:32:37 PM9/22/10
to clo...@googlegroups.com
First of all, MonoDevelop should be able to load the .sln

As far as XNA...last I heard XNA did not have any support for emit,
and as such is incapable of running any sort of jit code. Basically
all .NET code has to be ahead-of-time compiled to run a XBOX via XNA.
It's the same limitation that IronPython has
(http://ironpython.codeplex.com/wikipage?title=FAQ).

Timothy

> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

--
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)

Jarl Haggerty

unread,
Sep 23, 2010, 5:59:02 AM9/23/10
to Clojure
Is this still a problem if you compile everything ahead of time? I
noticed that if I make a jar with leiningen my clj files are included
in the jar but I assumed that it was just part of some dogma that I
should share my source code.

Also, I asked a similar question where I was concerned about the
things Timothy mentioned. The one answer I got was pretty much that
if the Xbox version of .Net had everything Clojure needed the Xbox
just wouldn't run clojure very well. Just like with Dalvik, the
Compact .Net handles GC poorly.

http://groups.google.com/group/clojure/browse_thread/thread/699d722f2632d3ce

Timothy Baldridge

unread,
Sep 23, 2010, 8:45:02 AM9/23/10
to clo...@googlegroups.com
> Is this still a problem if you compile everything ahead of time?  I
> noticed that if I make a jar with leiningen my clj files are included
> in the jar but I assumed that it was just part of some dogma that I
> should share my source code.

Actually I think it's a bit worse than that. LISP treats all code as
data and all data as code. Basically, in LISP you can take any list
and attempt to execute it. So even if you completely AOT compile the
code you're going to have to rip out any JIT functions to get it to
properly transfer to the Xbox.

>
> Also, I asked a similar question where I was concerned about the
> things Timothy mentioned.  The one answer I got was pretty much that
> if the Xbox version of .Net had everything Clojure needed the Xbox
> just wouldn't run clojure very well.  Just like with Dalvik, the
> Compact .Net handles GC poorly.
>

The biggest issue is that Clojure, IronPython, etc. are based on the
Microsoft DLR. This DLR makes heavy, heavy use of on-the-fly code
generation. As far as I know the 360 does not implement a full-blown
JIT (the bytecodes are translated to machine code on the development
PC then the resulting binary is shipped to the Xbox). Therefore the
DLR will not run on the Xbox and languages that require it will
either. That link you supplied doesn't state that "Xbox 360 has all
you need to run Clojure" but simply states that in addition to any
other issues you may have, Clojure would kill the GC.

Now what could happen is this: Someone could take the AST classes in
Clojure-CLR and convert them from code generation routines to
interpreted routines. Interpreted Clojure would run on the Xbox, there
just isn't an interpreter written yet.


Timothy

Wilson MacGyver

unread,
Sep 23, 2010, 10:27:38 AM9/23/10
to clo...@googlegroups.com
On xbox, you can't alter running code in memory, which means JIT basically
doesn't work. So imagine you are running java code on JVM in interpreted mode,
it's too slow for any serious game.

This is a common issue in most game consoles.

tsuraan

unread,
Sep 23, 2010, 1:07:49 PM9/23/10
to clo...@googlegroups.com
> First of all, MonoDevelop should be able to load the .sln

Ok, I'll have a look at that. I currently know nothing of .NET or
mono, so it's all news to me :)

> As far as XNA...last I heard XNA did not have any support for emit,
> and as such is incapable of running any sort of jit code. Basically
> all .NET code has to be ahead-of-time compiled to run a XBOX via XNA.
> It's the same limitation that IronPython has
> (http://ironpython.codeplex.com/wikipage?title=FAQ).

Ok, so for XBox stuff, ScalaCLR or F# would probably be more
practical. That's unfortunate, but I'm not way too surprised. Thanks
for the info!

tsuraan

unread,
Sep 23, 2010, 1:08:40 PM9/23/10
to clo...@googlegroups.com
>> As far as XNA...last I heard XNA did not have any support for emit,
>> and as such is incapable of running any sort of jit code. Basically
>> all .NET code has to be ahead-of-time compiled to run a XBOX via XNA.
>> It's the same limitation that IronPython has
>> (http://ironpython.codeplex.com/wikipage?title=FAQ).
>
> Ok, so for XBox stuff, ScalaCLR or F# would probably be more
> practical.  That's unfortunate, but I'm not way too surprised.  Thanks
> for the info!

And, as a lovely self-reply, replace that last "practical" with
"possible". I think that's more accurate.

Timothy Baldridge

unread,
Sep 23, 2010, 10:36:14 AM9/23/10
to clo...@googlegroups.com
"So imagine you are running java code on JVM in interpreted mode,
it's too slow for any serious game."

Meh...that's not exactly true. Many games (Warhammer 40k, Supreme
Commander, WoW, etc.) use stock LUA, and some (Civ IV) use Python.
Both of these are not JIT languages. Actually I would assume LIPS like
languages would actually run better than most in an interpreted VM due
to the simplicity of the VM. In fact picoLISP released some benchmarks
back in 2006 were they showed that interpreted picoLisp was actually
faster than compiled Common LISP [1].

So while having a highly advanced JIT like the JVM provides, I'm not
sure it's exactly a requirement for an acceptable Clojure variant.

Timothy Baldridge

[1] http://www.software-lab.de/radical.pdf

Jarl Haggerty

unread,
Sep 23, 2010, 1:41:33 PM9/23/10
to Clojure
(str "if " "Xbox 360 has all you need to run Clojure"), I was just
trying to emphasize that even if you could emit code you still had
other problems.

Wilson MacGyver

unread,
Sep 23, 2010, 1:59:35 PM9/23/10
to clo...@googlegroups.com
Not quite. Lua isn't a good example because it's a register based
runtime designed to be very small footprint. Also most of the games you
listed are PC.

Civ 4 uses python but it targets PC too. Consoles have very different and
strict set of rules.

We tried this last year, while we could get a bunch of CLR
languages to do basic things, they were failure from practical
use POV.

Yes it's possible to use embedded lisp as a scripting DSL on console,
GOAL on playstation is such an example. But again, it was designed from
ground up to do this. If that's what you want to do, you'd have better luck
starting with ecl(embedded common lisp). We've gotten that to work on
iPhone even.

Reply all
Reply to author
Forward
0 new messages