Hacker News new | comments | show | ask | jobs | submit login
Show HN: 入(rù-lang) – Clojurized JavaScript (ru-lang.org)
51 points by oyanglulu on June 20, 2015 | hide | past | web | favorite | 8 comments

Same idea, but a bit more mature: https://github.com/lantiga/ki

Edit: Actually, it's completely different... I was too fast to judge upon reading: a new language built with mori+sweetjs for easier javascript interop

But it might still be of interest to people here

I would feel uncomfortable to use the quotest to define something, like:

    fact 'defn arity func'
I think it would cause problems to have a good syntax hihlighting in the text editor.

This is not a definition; it's a string with the description of what is being tested. Analogous to this code:

  it("contains spec with an expectation", function() {

After re-reading the post it looks more like the helper in the lisp functions declarations.

   (defn fact (n)
       "factorial calculation"

NOTE: It's the first time I see the code.

Actually, `fact`, `should`, etc. seem to be macros, as provided here:


And following lines. It is a bit of syntactic sweetness over a preexisting testing framework. And I'm not convinced that they should be macros.

Unless sweet.js does something really original, macros are generally not first-class. You can't pass macros directly as parameters to functions, for example. I'd rather use macros to allow for nicer function call and attribute access syntax, in general, instead of special casing tests.

After taking a closer look at the language, I have some doubts. As of right now the language seems to be a random set of features that the author found cool implemented as Sweet.js macros, with the rest of JavaScript syntax unchanged. It would be a library in a Lisp world, even in Racket I don't think this level of functionality would be enough to justify writing a #lang.

At least two of the implemented features shouldn't be macros: into and fact/should because they then become second-class objects. You can't, for example, use `into` as an argument to `map`. Shorter lambdas are fine, personally I feel that the `=>` syntax native to JS is enough for this - but that's a matter of preference.

All in all, it looks like a very early attempt and there's still much to implement and improve. Have fun with this, OP! :-)

What do I use this for? - confused out of touch javascript dev

nice execution of an interesting idea!

i see removing the parens as an effort to rid the 'lispy' feel to the language, but how do you go about lexical scoping without parens like clojurscript or indentation like coffeescript? For example,

  fact 'init variables and return expr' {
    should let(a=1,b=2){a+b} => 3;
to what point will the let bindings be valid?

Presumably until the closing curly brace.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact