Hi Frank,

I'm wondering why no one ever posted a question/comment/reponse to this 
thread. Personally I think Clojure is a great language and the Erlang VM is 
a feat of engineering. I would love to think what other think about this 
thoughts and about the possibility of having Clojure on the Erlang VM in 
general.

There are some language features that don't quite map from Clojure to 
Erlang though, which are a challenge to implement. For example it is my 
understanding that all of Clojure abstractions rely either on Java 
interfaces (on the JVM) or on protocols (ClojureScript). So I guess a good 
implementation for the protocol mechanism would be needed for Clojure's 
implementation on the Erlang VM. 

In my head this means:

   1. Values would need to have a type tag, in order to be able to figure 
   out if they do or do not implement a certain protocol.
   2. A possible implementation would be a tuple whose first element is an 
   atom which represents the type (i.e. {type_whatever, ...})
   3. All functions that support this scheme and also the ones that 
   participate in the protocol mechanism need to "wrap/unwrap" values for 
   "type checking". 
   4. Previous points make interop with Erlang more complicated, since 
   Erlang code would need to account for this wrapping & unwrapping. Although 
   there could be a macro that figures some of these things automatically, but 
   it would still not be a seamless Erlang/Clojure interop.

There is also the matter of *namespaces* and *vars*, Clojure's bread and 
butter :P. 

In ClojureScript *namespaces* are not a thing you can manipulate [1] (you 
can't use **ns** for example), which could be a possible workaround to 
avoid maintaining runtime information about namespaces.

*Vars* on the other hand are not reified in ClojureScript [2] (they map to 
regular JavaScript variables). Vars either have a *root value*, are *unbound 
*or (when they are dynamic) might have a *thread bound value*. The first 
two are global state related to a var while the last one is local to each 
process (when talking about the Erlang VM). There are ways of implementing 
this in the Erlang VM, just to name one (which is probably not be the best 
one) using an ETS for global vars state and the process dictionary for the 
processes bindings (maybe implementing something analogous to Clojure's 
frames approach).    

Anyways...

These are just a couple of challenges in a possible implementation on the 
Erlang VM, which I think are key.

Cheers!

[1] At least not the last time I checked, although ClojureScript is on its 
way to being self-hosted so, who knows?
[2] The *var* special symbol provides compile time information though in 
ClojureScript.

On Friday, July 13, 2012 at 2:15:18 PM UTC-3, FrankS wrote:
>
> Just became aware of this effort: "http://erlangonxen.org/"; 
>
> which shows off some impressive properties: 
>
> * Startup time of a new instance is 100ms 
> * Instances are provisioned after the request arrival - all requests get 
> handled 
> * No instances are running waiting for requests - the cloud footprint is 
> zero 
> * the size of infrastructure is proportional to the maximum load - 8 
> servers may be enough 
> * … 
>
> All that begs the Q: would Clojure on an Elang-VM be feasible and make 
> sense? 
>
> -FrankS. 
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to