0

I'm working on a project that at some places would benefit greatly in code cleanliness if the problems were solved in a functional style. Now, Javascript is for the most part fully capable of doing functional programming, but I find that syntax gets in the way more often than not. The parentheses, having to write function and stuff like that.

So I'm looking for a way to somehow use a different language for those parts of the code. Either an embedded language that compiles to JS or an external scripting language with good interoperability.

Are there any existing solutions to this?

2
  • 1
    have you tried coffescript ? or an editor with ready snippets? Commented Mar 17, 2014 at 10:51
  • As a matter of fact I'm considering including coffeescript into my project. The syntax seems perfect for what I want to do. Commented Mar 17, 2014 at 11:00

1 Answer 1

1

This is typically a case for ClojureScript. You can use the Light Table environment with a node.js REPL and automatic compilation of Clojure code, or Vim, Sublime, Eclipse, Cursive or EMACS if you want.

Interoperability is obvious, you can access directly JavaScript objects and functions. You can embed JavaScript libraries and the code is optimized with Goggle Closure. Clojure function can be used directly in callback function or from JavaScript code.

Advantages... You have immutable environment but you can use JavaScript mutable states. A more orthogonal Truthey and Falsey on test. You can add a lot of libraries for goland sequences, mutable manipulation control, futures, ... Language is opinionated to ease pure function creation.

Sign up to request clarification or add additional context in comments.

1 Comment

In complement, it's an on going process with node.js so a link of an experiment plus.google.com/110423559145794735162/posts/7inon3eFvsd but with links at the end on other working on the problem. But concept works nice... Being polyglot is sometime a funny or not journey ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.