Live data from Hacker News

MoonScript, a programmer friendly language that compiles to Lua

moonscript.org

1–10 of 171 posts

Re: MoonScript, a programmer friendly language that compiles to Lua

#2
I love the syntax that Coffeescript-like languages are converging to, like Moonscript, tj's luna (https://github.com/tj/luna) and Pogoscript (http://pogoscript.org/). They fall way on the right of the "computer code vs. human code" spectrum, which is handy when writing applications as quickly as possible rather than focusing on fine details like implementation and performance. It's a shame I don't see it often in the wild, except for Atom and a few others.

Re: MoonScript, a programmer friendly language that compiles to Lua

#4
post #2

I love the syntax that Coffeescript-like languages are converging to, like Moonscript, tj's luna ( https://github.com/tj/luna ) and Pogoscript ( http://pogoscript.org/ ). They fall way on the right of the "computer code vs. human code" spectrum, which is handy when writing applications as quickly as possible rather than focusing on fine details like implementation and performance. It's a shame I don't see it often in…

Thankfully, GitHub starting gutting Coffee from Atom a long time ago. There's still too much in there though.

Re: MoonScript, a programmer friendly language that compiles to Lua

#6
post #3

I find Lua itself very programmer friendly.

Agreed, but it looks like it adds a layer of syntax to give you things like classes without the user having to leverage metatables.

That is correct. It's also done dynamically so you don't have any external dependencies required when transpiling to Lua code.

EDIT: I am not saying this is better - it could certainly be improved or, as is the case with a project of mine, injected into the runtime as a global value. It's just good for running MoonScript alongside Lua.

Re: MoonScript, a programmer friendly language that compiles to Lua

#7
I understand that people love programming in classes, but I really want something like a stripped-down ES6. In particular, I want:

1. Lists and objects/dicts only; objects have no prototypes at all; objects have no first-class methods, but they can have functions as member variables, and those functions can close over other data in the object

2. All function and variable declaration is anonymous (as a consequence of 1); if you want to define a schema for an object, build a function that takes certain arguments and returns an object with the corresponding structure.

3. Coroutines/fibers/etc for async things; no promise/callback hell

4. Type annotations a la Python (not sure how this fits with 2 just yet)

EDIT: I did a bad job of emphasizing this, but syntax is important to me--I want something that looks like:

    var foo = {
        x: [1, 2, 3],
        y: (a, b, c) => {
            var sum = a + b + c;
            sum * sum
        },
    }
Whether or not you agree that syntax should be a relevant criteria is a different matter. :)

Re: MoonScript, a programmer friendly language that compiles to Lua

#8
post #7

I understand that people love programming in classes, but I really want something like a stripped-down ES6. In particular, I want: 1. Lists and objects/dicts only; objects have no prototypes at all; objects have no first-class methods, but they can have functions as member variables, and those functions can close over other data in the object 2. All function and variable declaration is anonymous (as a consequence of…

This is basically Lua, excluding type annotations. Lua's form of OOP is very strange in that methods aren't bound to a parent context, but instead take the object as a value. For example, `object:method()` is the same as `object.method(object)`, and `function object:method()` is the same as `function object.method(self)` - the only difference being calling the function via `object:method()` is a bit more optimized. There is also a framework with networking, signals, and other cool features called `cqueues` which works based off of coroutines.s You might want to check that out too :)

Re: MoonScript, a programmer friendly language that compiles to Lua

#9
moonscript powers the itch.io indie marketplace - the original announcement has a quick write-up: http://leafo.net/posts/introducing_itchio.html

After spending years working with Ruby or Java, it was a very nice change of pace. Lapis (leaf's web framework) is crazy good as well: it's easy to write fast code, see this article on coroutines: http://leafo.net/posts/itchio-and-coroutines.html

(disclaimer: I work there with Leaf!)

Re: MoonScript, a programmer friendly language that compiles to Lua

#10
post #7

I understand that people love programming in classes, but I really want something like a stripped-down ES6. In particular, I want: 1. Lists and objects/dicts only; objects have no prototypes at all; objects have no first-class methods, but they can have functions as member variables, and those functions can close over other data in the object 2. All function and variable declaration is anonymous (as a consequence of…

Clojure [1] seems to meet all of these criteria. It's a functional language where you can get away with using only a few data types, while also supporting (most of) the rest of the things you mention.

[1] https://clojure.org/

Post reply on HN