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…
MoonScript, a programmer friendly language that compiles to Lua
11–20 of 171 posts
Re: MoonScript, a programmer friendly language that compiles to Lua
#12Earlier 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.
Re: MoonScript, a programmer friendly language that compiles to Lua
#13Re: MoonScript, a programmer friendly language that compiles to Lua
#14I 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
#15I 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
#16I 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
#17Adding 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…
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
#18Adding 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…
Re: MoonScript, a programmer friendly language that compiles to Lua
#19Earlier 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.
Re: MoonScript, a programmer friendly language that compiles to Lua
#20Adding 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…