TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

MoonScript - A programmer friendly language that compiles to Lua.

107 pointsby newtonapplealmost 14 years ago

18 comments

jacques_chesteralmost 14 years ago
I quite like the lua syntax as-is.<p>It's simple, predictable and easy to read.<p>This obsession with boiling everything down to strings of symbols is how folk wind up making fun of Perl and OCaml.<p>What's this do?<p><pre><code> $$&#38;[%] </code></pre> Or this?<p><pre><code> ?:&#62; </code></pre> Buggered if I know. <i>Only a professional Perl or OCaml programmer could tell you</i> -- and indeed I made those up. Only a professional Perl or OCaml programmer could tell if they do anything at all.<p>But pretty much anyone from any language background can eyeball an Algol-family syntax and tell you what's going down.
评论 #2872034 未加载
评论 #2871977 未加载
评论 #2872004 未加载
gmacalmost 14 years ago
Almost all the examples look like pure CoffeeScript (so I find it strange that this isn't mentioned/namechecked anywhere on the site).<p>Edit: happily, an attribution has now been added at the bottom, as noted in child comments.
评论 #2871899 未加载
评论 #2871849 未加载
评论 #2871897 未加载
评论 #2871839 未加载
skrebbelalmost 14 years ago
In all honesty, what's the point of this? I understand the point of compiling to JavaScript simply because that's the only language that runs on the most ubiquitous platform in the world. Why compile to any other high-level language?<p>Are there so many similar places where users are forced to use Lua, to warrant an extra layer? (with all the complexities such as debugging, a compile step, tracing errors back to MoonScript code, etc)<p>Note, I'm not commenting about the language's choices. Maybe coding in MoonScript rocks big time. I just don't get why it compiles to Lua.
评论 #2873761 未加载
评论 #2872373 未加载
评论 #2872734 未加载
评论 #2873838 未加载
评论 #2872941 未加载
wildmXranatalmost 14 years ago
If this compiles into Lua/JIT bytecode then there might be a use for it, if this transforms into Lua code then what is the point? Lua is a great and simple language, so this would seem useless
评论 #2872559 未加载
评论 #2872819 未加载
评论 #2872790 未加载
评论 #2872847 未加载
neworbitalmost 14 years ago
Very cool. I confess I'm not likely to use it anytime soon, since I am conversant with how Lua works today and not so much with Coffeescript, but I'm glad for the aid to adoption!
rbxbxalmost 14 years ago
The killer feature of MoonScript would be 0 based indexes. See no mention of it though...
aashayalmost 14 years ago
Anybody try writing an iPhone app with MoonScript -&#62; Lua -&#62; Wax -&#62; Objective C?
评论 #2871891 未加载
stephthalmost 14 years ago
This looks very promising. Congrats on the launch.<p>I am enjoying this wave of new programming languages that compile down to existing ones in a human readable way. They are pleasant to write and read and yet performant and don't require a special runtime, making them easy to integrate anywhere in their parent language.<p>I hope someone talented will build one of these for C/C++. Mobile an game developers could use it.
评论 #2872141 未加载
svdadalmost 14 years ago
Still don't understand the fad for "programmer-friendly" languages. Why on earth would you even start learning to program if you didn't find something diabolically fascinating about learning a new syntax for symbolic computation?<p>C, C++, APL, etc. all seem perfectly "programmer-friendly" to me, once you've learned them...
wsxiaoysalmost 14 years ago
Wow, i've asked this before, <a href="http://www.reddit.com/r/coffeescript/comments/hmtjv/what_about_implement_a_lua_backend_for/" rel="nofollow">http://www.reddit.com/r/coffeescript/comments/hmtjv/what_abo...</a><p>Really happy to see some action!
Herald_MJalmost 14 years ago
Lua isn't programmer friendly?
评论 #2872491 未加载
clyfealmost 14 years ago
There's also this effort <a href="https://github.com/CDR2003/coffee-script-lua" rel="nofollow">https://github.com/CDR2003/coffee-script-lua</a> don't know how far it reached tough.
blackRustalmost 14 years ago
The first thing I do is click on the 'Lua' link. <a href="http://ww.lua.org" rel="nofollow">http://ww.lua.org</a> Really? Please fix.
z92almost 14 years ago
The next time I need to code in C, I shall try moonscript first. Thanks author for this great piece of software.
vjeuxalmost 14 years ago
<a href="http://moonscript.org/reference/#considerations" rel="nofollow">http://moonscript.org/reference/#considerations</a><p><pre><code> b = x-10 is converted to local b = x(-10) </code></pre> This looks like to be really error prone.
malkiaalmost 14 years ago
That looks very cool!
nknightalmost 14 years ago
Some of this is a definite improvement over Lua, but I'm getting really tired of some of these cute little syntaxes showing up everywhere, like '-&#62;' and '=&#62;' for creating functions, and what's with this:<p><i>! operator can be used to call a function with no arguments</i><p>Seriously?<p>I feel like people are coming up with these things just to be "different". Programming language syntax is a UI, and needs to be treated like one -- you don't make major changes to basic UI paradigms without convincing reason.<p>Edit: Maybe more to the point, you don't add random buttons to a UI that do non-obvious things. Language syntax should be self-evident and quickly readable, and shouldn't require careful parsing of individual characters.
评论 #2871953 未加载
hackinthebochsalmost 14 years ago
I will be extremely happy when the whitespace-for-blocks fad passes. I have a feeling it's going to be a long winter.
评论 #2872905 未加载