Live data from Hacker News

MoonScript, a programmer friendly language that compiles to Lua

moonscript.org

11–20 of 171 posts

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

#11
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. T…

And the size of the Lua runtime is nothing short of beautiful. I have yet to find a use for Lua though, so I'm still waiting for an opportunity to work on something with it.

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

#12
post #11

Earlier quoted context omitted.

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. T…

And the size of the Lua runtime is nothing short of beautiful. I have yet to find a use for Lua though, so I'm still waiting for an opportunity to work on something with it.

I find it's used a lot in places you wouldn't expect. I found it used in a car radio, the modem used in my house, and a few other places. It's lightweight if you want to use it on embedded systems (for example, NodeMCU) if you're into that kind of thing.

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

#13
This is one of @leafo's excellent projects. He has developed a web framework for MoonScript called Lapis. One of the cool things about Lapis is that it runs on top of OpenResty, which is a high performance web server for Lua applications. Lapis is production-ready: it runs his amazing game marketplace, itch.io.

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

#14
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 a value to a variable? Now you have a new variable. Where to look for the definition of a variable? It depends on what runs first now. That's not friendlier. CoffeeScript made the same mistake in the name of simplicity and it quite frankly doesn't add any value. The time you saved typing "local" will be now consumed several times debugging and code reviewing... and you will have to pay more attention during your code reviews.

Then, removing braces and other delimiters. That's not necessarily better either. Let's remove lane delimiters from streets, traffic signals, stop and yield signs, and let's make it all implicit based on rules you can follow in your head. See? doesn't work.

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

#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 following open source websites: https://github.com/luarocks/luarocks-site https://github.com/leafo/streak.club

The company I made, https://itch.io also runs on it. There are a a ton of extra Lua modules I've made in MoonScript to facilitate it. Here's a list of my published modules: https://luarocks.org/modules/leafo

I've also completed Ludum Dare 11 times now, making a game each time in MoonScript. I've used https://love2d.org/ as the game engine. You can find the games on my GitHub: https://github.com/leafo?tab=repositories

Feel free to ask any questions

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

#16
post #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.

While I understand the move to es6 or whatever we're calling it now, a part of me really misses coffeescript. I found it to be very elegant

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

#17

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 would rather provide conclusive proof, like some side to side comparison of features to illustrate how idiomatic MoonScript is supposedly friendlier than Lua.

In the reference manual, it is quite literally a side by side comparison. MoonScript code is shown to the left, with Lua to the right. MoonScript provides shortened code with minimal overhead compared to how it would be implemented in Lua, and you can see how by viewing the reference manual.

> For example, what if you have a typo in a variable identifier when assigning a value to a variable? Now you have a new variable. Where to look for the definition of a variable? It depends on what runs first now. That's not friendlier. CoffeeScript made the same mistake in the name of simplicity and it quite frankly doesn't add any value. The time you saved typing "local" will be now consumed several times debugging and code reviewing... and you will have to pay more attention during your code reviews.

This is the same problem with Lua. The best solution that I've found is to have an editor that highlights variables in different colors; once the color has changed (and it should based on if it's similarly named to another variable, so that `asdf` should be a very different color to `asdg`) you know it's a different variable.

> Then, removing braces and other delimiters. That's not necessarily better either. Let's remove lane delimiters from streets, traffic signals, stop and yield signs, and let's make it all implicit based on rules you can follow in your head. See? doesn't work.

Except you can still know when a block ends. Your comparison isn't really fair because it's just a cosmetic change. It's as though stop signs were a square instead of an octogon, not if they were just completely removed.

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

#18

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…

[deleted]

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

#19
post #11

Earlier quoted context omitted.

And the size of the Lua runtime is nothing short of beautiful. I have yet to find a use for Lua though, so I'm still waiting for an opportunity to work on something with it.

I find it's used a lot in places you wouldn't expect. I found it used in a car radio, the modem used in my house, and a few other places. It's lightweight if you want to use it on embedded systems (for example, NodeMCU) if you're into that kind of thing.

Iirc its used on some digital cameras as well.

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

#20

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…

How are they just noise? If somebody says that something is "fast", it's because it's purpose is to be fast and nothing else. If something says it's lightweight it means it's aim is a minimal size. They are not noise, they are mission statements.
Post reply on HN