Clojure and Android

231 views
Skip to first unread message

Ze maria

unread,
Nov 26, 2007, 6:41:17 AM11/26/07
to clo...@googlegroups.com
Hi guys,
I was wondering if anyone has tried to load clojure on Android, that is , if it works on Dalvik Virtual machine

Tks in advance,
Ze Maria

Stefan Lang

unread,
Nov 27, 2007, 5:54:16 PM11/27/07
to Clojure
That won't work because Clojure generates JVM bytecode and
Dalvik has its own bytecode.

(Pretty dumb move from Google, now all dynamic languages
for the JVM need a second backend for Dalvik, otherwise
most of it would have worked out of the box.)

Henk Boom

unread,
Nov 27, 2007, 6:18:53 PM11/27/07
to clo...@googlegroups.com
On 27/11/2007, Stefan Lang <langs...@gmx.at> wrote:
>
> That won't work because Clojure generates JVM bytecode and
> Dalvik has its own bytecode.
>
> (Pretty dumb move from Google, now all dynamic languages
> for the JVM need a second backend for Dalvik, otherwise
> most of it would have worked out of the box.)

If I understand correctly the Dalvik bytecode is generated from the
Java bytecode. It might be hard to handle the runtime compilation used
by Clojure though.

"The Dalvik VM executes files in the Dalvik Executable (.dex) format
which is optimized for minimal memory footprint. The VM is
register-based, and runs classes compiled by a Java language compiler
that have been transformed into the .dex format by the included "dx"
tool."
http://code.google.com/android/what-is-android.html#runtime

I've been curious for other reasons as well: what features of Clojure
would be lost if all the compilation had to be done statically? Just
eval, or others as well? Are those features easy enough to avoid that
some applications could save space by not including the Clojure
compiler in the jar?

Henk Boom

Rich Hickey

unread,
Nov 28, 2007, 5:06:01 PM11/28/07
to Clojure


On Nov 27, 6:18 pm, "Henk Boom" <lunarcri...@gmail.com> wrote:
> On 27/11/2007, Stefan Lang <langste...@gmx.at> wrote:
>
>
>
> > That won't work because Clojure generates JVM bytecode and
> > Dalvik has its own bytecode.
>
> > (Pretty dumb move from Google, now all dynamic languages
> > for the JVM need a second backend for Dalvik, otherwise
> > most of it would have worked out of the box.)
>
> If I understand correctly the Dalvik bytecode is generated from the
> Java bytecode. It might be hard to handle the runtime compilation used
> by Clojure though.
>

Yes, although if they were to put Java bytecode-to-Dalvik bytecode
conversion into the runtime...

> "The Dalvik VM executes files in the Dalvik Executable (.dex) format
> which is optimized for minimal memory footprint. The VM is
> register-based, and runs classes compiled by a Java language compiler
> that have been transformed into the .dex format by the included "dx"
> tool."http://code.google.com/android/what-is-android.html#runtime
>
> I've been curious for other reasons as well: what features of Clojure
> would be lost if all the compilation had to be done statically? Just
> eval, or others as well? Are those features easy enough to avoid that
> some applications could save space by not including the Clojure
> compiler in the jar?
>

It opens up the whole notion of compile-time/load-time/runtime which
are currently one and the same. Issues like - when do macros become
available, does compilation affect the global environment, eval-when
etc. There are also issues relating to the serializeability and
identity of object literals. These are not insurmountable, but not top
priority. I am thinking about it, as several people have asked, and I
am interested in having Clojure on Android.
Reply all
Reply to author
Forward
0 new messages