Live data from Hacker News

MoonScript, a programmer friendly language that compiles to Lua

moonscript.org

51–60 of 171 posts

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

#51
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 was just looking at love2d, I don't know much about it. My son is 8 and is very bored with Scratch. A once over the documentation makes me think love2d might be a good fit for a next step from Scratch. How is the love2d community and is it active?

love2d is great. I've dabbled with a bunch of game engines and am an avid lover of Processing and p5.js, both of which are great for learning to code. Love2d is right up there with them, though the documentation is less newbie-oriented, IMO. The best thing for you to do would be to go through this tutorial yourself and then decide if you think it would be appropriate for your kid. http://sheepolution.com/learn/book/contents

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

#52
post #16
post #4

Earlier quoted context omitted.

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

Agreed. Coffeescript was excellent lipstick for the pig that is javascript.

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

#53

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…

The reason is that the _ENV feature added in 5.2 would significantly slow down LuaJIT if it were supported. It's possible that Luac and LuaJIT will re-converge when Lua 6.0 is released, but arguments about this between Mike Pall amd Roberto Ierusalimschy have been unproductive so far. Until then, LuaJIT compiles Lua 5.1 with support for a few 5.2 and 5.3 features, particularly goto.

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

#54
post #50

Earlier quoted context omitted.

Except that that whitespace is not used only for that purpose, it could mean also something else, right? We trade an unambiguous set of characters --the parentheses-- by whitespace, and make it context sensitive. How is that now more readable? As someone who has had to match these whitespace based parenthesis I can tell you it's not more readable. It's more like someone determined that parenthesis were not visually p…

> Except that that whitespace is not used only for that purpose, it could mean also something else, right It's not just whitespace, it's the specific formatting of whitespace. It's just a character, like any other, only defined by it's lack of distinguishing characters. Instead of whitespace, block continuations could be defined by pipes, or angle brackets, or any number of things. They chose wihtespace. > We trade a…

> It's not just whitespace, it's the specific formatting of whitespace.

Yes. Specific, context sensitive, that requires disambiguation in your head and therefore harder to read.

> We trade an unambiguous set of characters --the parentheses-- by whitespace, and make it context sensitive. Parenthesis are often context sensitive in languages.

Yes, but they're consistent with the mathematical notation everyone has used over their entire life. By the time you pick up a programming language you have most likely used parenthesis for a while.

I am going to create a new language 99% identical to English, where fork means knife, knife means spoon and spoon means fork. Have a happy time translating paragraphs of text involving those 3 objects from English into my language.

> "Readable" is subjective.

Yes. But implicit vs explicit is not subjective. Implicit meaning takes non-zero effort to understand. It works when you the implicit subject is not relevant and you can be abstracted from it, but in this case there is no encapsulation taking place. Therefore, we could objectively say it's less readable. Quod erat demonstrandum.

> Or, it actually is that some people prefer it, even if you and I do not, and that's what it is

Now you have 2 ways of doing the same thing with no added value. Now you have more possible ways of writing down an expression, if you are parsing an expression or refactoring your code with a regex now it's much more complex. If you are writing a coding standard now you will have to make rules for it, and people may not reach agreement on those rules. People may have meeting to discuss which one to use and why, and spend time moving from one style to the other. It's a waste of time.

In 2017 there's still people fighting over tabs vs spaces. Now we add another dimension to it: spaces vs parenthesis. An endless source of bikeshedding.

> In the end, unless you're being forced to use this language

That's not how it works. I have had to use languages that I dislike because that was what was needed in my organization.

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

#55
On a related topic, Haxe now compiles to Lua as well : https://haxe.org/blog/hello-lua/ (disclosure : I'm the author of the lua target)

Back to moonscript/Lua, I've been super impressed with the YAGNI principals of the language. I was originally drawn to LuaJIT and its raw speed, but there's a lot of great things to say about the language and its community.

My goal is to write more Lua for smaller scripting purposes, and use Haxe/Lua for more complex projects, taking advantage of LuaJIT speed in both cases.

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

#57

Earlier quoted context omitted.

Are you aware that TIC-80 supports moonscript? It's one of the better PICO-8 "clones" out there. https://nesbox.itch.io/tic https://github.com/nesbox/tic.computer/wiki#cartridge-metada...

Is that open source? I'm wondering if it uses SDL or a similar library - binaries look pretty small.

No source code, but looking at the Windows binary it's using a statically linked copy of SDL 2.

Plus that file's about 2 MB, so really not surprisingly small.

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

#58
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…

Moonscript uses local by default (compiles to Lua). Here is your code in Moonscript:

    foo = {
      x: {1, 2, 3},
      y: (a, b, c) ->
        sum = a + b + c
        sum * sum
    }

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

#59
"Moonscript is like CoffeeScript for Lua"

That's a very succinct description and from skimming the examples, quite apt.

But what I want is Typescript for Lua, specifically to use with Redis. That way I can define interfaces for my keys/values and have static checks on their usage.

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

#60
post #59

"Moonscript is like CoffeeScript for Lua" That's a very succinct description and from skimming the examples, quite apt. But what I want is Typescript for Lua, specifically to use with Redis. That way I can define interfaces for my keys/values and have static checks on their usage.

Check out Haxe: https://haxe.org/blog/hello-lua/
Post reply on HN