The guys who developed Node.js implemented it on top of a virtual machine which supports only one programming language - JavaScript. If they'd wanted us to use multiple programming languages they could have implemented Node.js on top of the Java/Hotspot VM and it's rich and mature support for multiple languages. But they didn't. There are a couple examples of "other" languages being used to write Node.js programs, such as CoffeeScript.
A new example of this is Fargo. The developer has this to say about it: Fargo is a programming language that runs on Node.js. It's designed to ease asynchronous functional programming by providing features missing in JavaScript, namely tail recursion and some form of continuations. It is still an experiment and a toy.
The idea is to run code like the following on top of Node.js using a layer which makes the thing pretend it's not quite a Scheme system:
(define square (lambda (x) (* x x)))
(puts (map square '(1 2 3 4)))
(puts (let ((x 1)
(y 2)
(z 3)
(h 7))
(+ (+ x y) z)))
I don't quite get the purpose of having all those parenthesis, and for that matter I was never able to figure out LISP or Scheme.
The developer says: The main reason for Fargo's existence at present is to add fibers to the Node environment to make async programming easier. Fibers are a lightweight form of continuations that allow blocks of code to be suspended and resumed by the user. Many Ruby programmers are using fibers to let them write non-blocking code with blocking-style syntax. And, I can say after having written a few Node.js programs that the asynchronous programming model is a hurdle. It's desirable to have something to lower the hurdle a bit.
But, all these parenthesis?
The idea of "When a fiber is running, you can use the yield function which suspends the fiber and returns the yielded value as the result of the fiber's invokation" is attractive, but does it have to be implemented by a non-JavaScript language?
Just some thoughts...
Source: https://github.com/jcoglan/fargo