Live data from Hacker News

MoonScript, a programmer friendly language that compiles to Lua

moonscript.org

101–110 of 171 posts

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

#101
post #15

Hey all, I made MoonScript about 6 years ago. I used it to build a ton of opensource stuff in addition to the company I founded. I use it every day and I'm very happy with how it's turned out. I regret not updating the language more frequently, but I've been busy building a bunch of stuff in it. The biggest open source project is a web framework for Open Resty: https://github.com/leafo/lapis It's used for the followi…

The font you are using looks broken to me. (Win 10, Firefox)

At 100% scaling, every "i" clearly looks like a "1". It reads "MoonScr1pt" for me: https://i.imgur.com/Ti12E5I.png

If I zoom in or out in the browser the i looks ok again.

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

#102

Adding superlatives to your stuff is, to me, just noise. e.g: "fast", "simple", "friendly", "lightweight". I would rather provide conclusive proof, like some side to side comparison of features to illustrate how idiomatic MoonScript is supposedly friendlier than Lua. Personally I think the changes are not necessarily in the right direction: For example, what if you have a typo in a variable identifier when assigning…

Side by side: the examples on the landing page have a "Show LUA" button, so you can easily compare.

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

#103

Lapis + MoonScript + OpenResty looks like a lot of fun, so I was just starting to get a local environment running for it and immediately ran into the Lua 5.1 and 5.2+ divergence. For someone who has just been a casual observer of the Lua ecosystem over the years, can someone talk about the community's feelings towards that divergence? The OpenResty docs basically state it's not worth the effort to support anything bu…

There is divergence, it's been a known issue in the community for years. I already had that slide in my 2013 "state of the Lua ecosystem" talk: http://files.catwell.info/presentations/2013-11-lua-workshop...

The views on the issue amongst the community are divided too. Personally, I have decided most of my new code won't support Lua versions older than 5.3. That means no LuaJIT. If I have to use OpenResty seriously again, I will fork and adapt it to support PUC Lua 5.3. In the meantime, I use Xavante and WSAPI for the little Web code I write in Lua.

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

#104

Adding superlatives to your stuff is, to me, just noise. e.g: "fast", "simple", "friendly", "lightweight". I would rather provide conclusive proof, like some side to side comparison of features to illustrate how idiomatic MoonScript is supposedly friendlier than Lua. Personally I think the changes are not necessarily in the right direction: For example, what if you have a typo in a variable identifier when assigning…

I see it as a toy language. The only person I think would find it useful is leafo himself since he can edit it however he wants. But everyone else should stay away from it. Plain Lua is so much better.

There are a lot of features that make Moonscript much more convenient than plain Lua. Examples (try the first three in Lua):

- default values for function parameters

- list comprehensions

    [x * 2 for x in *{1, 2, 3}]
- easier iteration (e.g. `for key, value in pairs obj`)

- local is default, not global

- a simple class system if you need it

- `export`, `from` and `import` keywords

- `+=`, `/=`, `*=` etc. operators

- indentation based scope (ok, this is debatable)

I can't think of a single place where plain Lua is actually better. OK maybe `:` is better as a method call operator, but that's it.

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

#105
post #15

Hey all, I made MoonScript about 6 years ago. I used it to build a ton of opensource stuff in addition to the company I founded. I use it every day and I'm very happy with how it's turned out. I regret not updating the language more frequently, but I've been busy building a bunch of stuff in it. The biggest open source project is a web framework for Open Resty: https://github.com/leafo/lapis It's used for the followi…

Thank you for Moonscript!

> The biggest open source project is a web framework for Open Resty: https://github.com/leafo/lapis

Looks like lapis is ~15K lines. The Howl editor has ~58K lines (including bindings and tests) - making it bigger, technically ;)

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

#106

Lapis + MoonScript + OpenResty looks like a lot of fun, so I was just starting to get a local environment running for it and immediately ran into the Lua 5.1 and 5.2+ divergence. For someone who has just been a casual observer of the Lua ecosystem over the years, can someone talk about the community's feelings towards that divergence? The OpenResty docs basically state it's not worth the effort to support anything bu…

For people knowing Lua a bit longer, the "divergence" is nothing surprising, it's an explicit and very long standing design choice by Lua authors. Specifically, that's what allowed them to evolve Lua to the awesome language it is, by making breaking changes when they invented/converged on a notably better way to do something. Personally, I find it more appropriate to look at each new Lua version as a wholly new language, rather than a "new release of the same language". A new language, which "accidentally", as a bow to the user, is very, very similar to the "previous language" from the Lua family (to the point of usually being API and syntax compatible).

Actually, the changes between 5.1, 5.2, 5.3 are super small and smooth compared to what was done between e.g. 4.x and 5.x, where language syntax was changed. Between 5.x versions, with some effort you can make your code portable, if you wish so. (I'd say that's what one would expect when seeing the major digit unchanged in a version string.) There are many libraries which take care to. I'm not 100% sure about this one (i.e. haven't checked), but from the top of my head, based on the author's reputation, I'd blindly say https://github.com/stevedonovan/Penlight should be a nice example of a library portable between 5.x versions.

The proliferation of the 5.1 version is sometimes semi-jokingly seen as a "curse of success" - that it became the first version to really nail it so well, that it spread so wildly, and the newer versions bring small enough changes, that some people find it hard to justify any effort at all to upgrade. But it's also perfectly OK: Lua 5.1 is a great language already, and can simply be seen as a done/completed work.

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

#107
post #15

Hey all, I made MoonScript about 6 years ago. I used it to build a ton of opensource stuff in addition to the company I founded. I use it every day and I'm very happy with how it's turned out. I regret not updating the language more frequently, but I've been busy building a bunch of stuff in it. The biggest open source project is a web framework for Open Resty: https://github.com/leafo/lapis It's used for the followi…

That's a lot of work you've done alone :)

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

#108
post #15

Hey all, I made MoonScript about 6 years ago. I used it to build a ton of opensource stuff in addition to the company I founded. I use it every day and I'm very happy with how it's turned out. I regret not updating the language more frequently, but I've been busy building a bunch of stuff in it. The biggest open source project is a web framework for Open Resty: https://github.com/leafo/lapis It's used for the followi…

I'm thinking of creating a blackbox site building service in lua and store people's code in db.

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

#109

Earlier quoted context omitted.

Care to give an example?

The list comprehensions are really great. Most of the time when I'm writing Lua I can't be bothered to write exactly what Moonscript outputs for a list comprehension because it's noisy, but it's what I really would write if I cared about tiny amounts of performance.

Idk. Still not sold. You can do list comprehensions in regular Lua with something like this:

    function listcomp(t, f)
        local r = {}
        for k,v in pairs(t) do
            r[k] = v
        end
        return r
    end
And then, your Lua code would be like:

    listcomp({1, 2, 3, 4}, function(k, v)
        return v*2
    end)
Which would be the equivalent to this in MoonScript:

    [v*2 for k,v in pairs({1, 2, 3 ,4})]
I dunno. Just seems like a wash to me. And then you think about the extra compile step to run MoonScript, and the potential performance hits, and I'm just turned off completely from it.

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

#110
post #15

Hey all, I made MoonScript about 6 years ago. I used it to build a ton of opensource stuff in addition to the company I founded. I use it every day and I'm very happy with how it's turned out. I regret not updating the language more frequently, but I've been busy building a bunch of stuff in it. The biggest open source project is a web framework for Open Resty: https://github.com/leafo/lapis It's used for the followi…

I have to say that if I see last update in changelog from few years ago I assume the project is dead and one should not use it.
Post reply on HN