github leafo/moonscript v0.2.4
MoonScript v0.2.4

latest releases: v0.5.0, win32-v0.5.0, v0.4.0...
10 years ago

I'm happy to announce MoonScript version 0.2.4, the CoffeeScript inspired language that compiles to Lua. It's been about 5 months since the last release.

As always, if you've got any questions or want to tell me about how you are using MoonScript you can email me or contact me on twitter.

You can find the full release notes on my blog: http://leafo.net/posts/moonscript_v024.html

Changes

  • The way the subtraction operator works has changed. There was always a little confusion as to the rules regarding whitespace around it and it was recommended to always add whitespace around the operator when doing subtraction. Not anymore. Hopefully it now works how you would expect. (a-b compiles to a - b and not a(-b) anymore).
  • The moon library is no longer sets a global variable and instead returns the module. Your code should now be:
moon = require "moon"
  • Generated code will reuse local variables when appropriate. Local variables are guaranteed to not have side effects when being accessed as opposed to expressions and global variables. MoonScript will now take advantage of this and reuse those variable without creating and copying to a temporary name.
  • Reduced the creation of anonymous functions that are called immediately.
    MoonScript uses this technique to convert a series of statements into a single expression. It's inefficient because it allocates a new function object and has to do a function call. It also obfuscates stack traces. MoonScript will flatten these functions into the current scope in a lot of situations now.
  • Reduced the amount of code generated for classes. Parent class code it left out if there is no parent.

New Things

  • You can now put line breaks inside of string literals. It will be replaced with \n in the generated code.
x = "hello
world"
  • Added moonscript.base module. It's a way of including the moonscript module without automatically installing the moonloader.
  • You are free to use any whitespace around the name list in an import statement. It has the same rules as an array table, meaning you can delimit names with line breaks.
import a, b
  c, d from z
  • Added significantly better tests. Previously the testing suite would only verify that code compiled to an expected string. Now there are unit tests that execute the code as well. This will make it easier to change the generated output while still guaranteeing the semantics are the same.

Bug Fixes

  • b is not longer treated as self assign in { a : b }
  • load functions will return nil instead of throwing error, as described in documentation
  • fixed an issue with moon.mixin where it did not work as described

Other Stuff

Libraries

Some updates for libraries written in MoonScript:

  • Lapis, the MoonScript powered web framework has come out with version
    0.0.2.
  • magick, LuaJIT FFI bindings to ImageMagick
  • web_sanitize, HTML sanitization

Games

Ludum Dare happened again, and I wrote another game in MoonScript:

Thanks

Thanks to everyone who provided feedback for this release. See you next time.

Don't miss a new moonscript release

NewReleases is sending notifications on new releases.