Compile OCaml to JavaScript, Run on Node
hyegar.com
hyegar.com
A friend of mine evaluated it for his own need and went with Meteor citing that reason (plus ease of hiring for js). I've gotten a similar feel looking at the code samples.
Take for example this basic example:
{server{
let get_data_forum forumid =
lwt messages = Db.get_messages forumid in
let default = {'a option{
try Some (Eliom_cscache.find_if_ready %forumcache %forumid)
with _ -> None
}}
in
Lwt.return (SharedReactiveData.RList.make ~default messages)
let get_data_forum_rpc =
server_function Json.t<int>
(Eba_session.Opt.connected_rpc
(fun userid_o forumid -> get_data_forum forumid))
}}
{client{
let get_data_forum forumid = %get_data_forum_rpc forumid
}}
This feels awfully verbose for what it does...Opa differs in that it is a new language though, but the compiler is written in OCaml and compiles the Opa language to JavaScript (using by default Node.js and MongoDB).
Compared to this project, Opa provides much more automation (ORM except it's neither Object nor Relational, slicing i.e. separation of client and server code, etc.).
Disclaimer: I'm the creator of Opa.
(Also, isn't opa a bit, you know, dead ?)
https://github.com/jashkenas/coffeescript/wiki/list-of-langu...
"And why do you need type safety? Because you are used to?"
Er. Well, if you like driving a car with no seatbelts, crumple zone, or airbags, I guess that's fine with me. But when I get in a car, I buckle up.
Static type systems prevent you from expressing certain programs (I think this is a good thing, but not everyone does).
A better analogy would be antilock brakes or understeer - safer but prevents you from doing certain things.
(both you and the parent comment are kinda doing this)
The
"If you don't like JavaScript, just use CoffeeScript like everyone else! What's wrong with you?"
reaction made me laugh.This is better than nothing, sure, because your code is first checked in OCaml but once the code is running, it does it according to Javascript rules.
I imagine there could be subtle bugs introduced during this process (e.g. your OCaml code manipulate integers, but Javascript has numbers, a.k.a. double floats, as far as I know).
Here, the compiler emits (a subset of) javascript which are assumed to have a semantics, and we trust the browser engine to execute it according to the semantic.
Of course we don't assume the semantic of javascript to be sane, we just assume it follows the spec (and we emit accordingly).
Any code generation machinery is subject to subtle bugs and especially so the flesh and bones kind ;)