Hacker News new | ask | show | jobs
by bsaul 4475 days ago
How do those "to js" code generator behave when used together with frameworks like backbone or angular ?

I know things like typescript or dart have special versions of the framworks, but i'm curious to know how the ocaml to js tools behave ( since i've searched for a decent strongly typed server side technology for years, that would be an argument for me to try that language).

2 comments

I don't know about OCaml, but generally speaking, there is a foreign function calling interface. You'd typically use it for integrating with large standalone codebases you don't want to rewrite (say, CodeMirror) but typically not for frameworky things. If you're going to use the same UI framework there's not much point in switching languages.
OCaml has quite nice JavaScript integration; it has the ability to interact with JS objects, constructors, DOM objects, etc. See the "dom bindings" thread elsewhere in this discussion.

Most other AltJS languages I've seen are primarily based around FFI declarations, where all interaction with JS is done via functions declared in the native language as external and implemented in JS.