tag:github.com,2008:https://github.com/leafo/moonscript/releasesRelease notes from moonscript2026-01-10T01:13:26Ztag:github.com,2008:Repository/1786885/v0.6.02026-01-10T01:36:53Zv0.6.0<h2>New Features</h2>
<h3>Command Line Improvements</h3>
<ul>
<li><strong>Switched from alt_getopt to argparse</strong> - Both <code>moon</code> and <code>moonc</code> now use argparse for argument parsing, providing better help messages via <code>--help</code> and more robust option handling</li>
<li><strong>Added <code>-e/--execute</code> flag to <code>moon</code></strong> - Execute MoonScript code directly from the command line:
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="moon -e "print 'Hello World'""><pre class="notranslate"><code>moon -e "print 'Hello World'"
</code></pre></div>
</li>
<li><strong>New <code>--transform</code> option for <code>moonc</code></strong> - Allows custom AST transformations before compilation by specifying a module that receives and returns the syntax tree</li>
<li><strong>Improved <code>-</code> (stdin) handling</strong> - Now properly enforces that <code>-</code> must be the only argument</li>
</ul>
<h3>moonc Option Renames</h3>
<ul>
<li><code>-w</code> is now also available as <code>--watch</code></li>
<li><code>-l</code> is now also available as <code>--lint</code></li>
<li><code>-t</code> is now also available as <code>--output-to</code></li>
</ul>
<h3>New Tools</h3>
<ul>
<li><strong>moon-tags</strong> - New script for generating ctags-compatible tag files for MoonScript, with support for:
<ul>
<li>Class definitions</li>
<li>Class methods</li>
<li>Top-level function definitions (exported via <code>{:func}</code> pattern)</li>
<li>Lapis route detection (<code>--lapis</code> flag)</li>
<li>Optional line numbers (<code>--include-line</code> flag)</li>
<li>Optionally skip header (<code>--no-header</code> flag)</li>
</ul>
</li>
</ul>
<h3>Utility Improvements</h3>
<ul>
<li><strong><code>moon.p()</code> now prints multiple arguments</strong> - Pass multiple values and each will be dumped</li>
<li><strong><code>util.dump</code> shows class names</strong> - When dumping objects, the class name is displayed (e.g., <code><MyClass>{...}</code>)</li>
</ul>
<h3>Compiler Enhancements</h3>
<ul>
<li><strong>Lua keyword property access on self</strong> - Properties with Lua keyword names (like <code>@then</code> or <code>@@then</code>) now compile correctly using bracket notation instead of invalid <code>self.then</code></li>
</ul>
<h2>Bug Fixes</h2>
<ul>
<li><strong>Fixed ambiguous Lua generation after <code>import</code></strong> - Semicolons are now correctly inserted when the next line starts with <code>(</code>, preventing parsing ambiguity</li>
<li><strong>Fixed update operators with complex chain indexes</strong> - Expressions like <code>a[func()].x += 1</code> now correctly lift the index expression to avoid double evaluation</li>
<li><strong>Exit with proper error code</strong> - <code>moon</code> now exits with code 1 when the executed script fails</li>
<li><strong>Fixed <code>moonc -</code></strong> - Reading from stdin now works correctly</li>
<li><strong>Removed accidental debug print</strong> - Removed stray <code>print file, time</code> in watcher code</li>
<li><strong><code>dump.tree</code> returns string</strong> - Now returns the string instead of printing directly</li>
<li><strong>Removed noisy "Built" message</strong> - Single file compilation no longer prints "Built" to stderr</li>
</ul>
<h2>Internal Changes</h2>
<ul>
<li>Migrated CI from Travis to GitHub Actions</li>
<li>Added comprehensive compiler and transform specs</li>
<li>Improved binary building workflow for Windows and Linux</li>
<li>Better error messages for invalid destructure assignments</li>
<li>Updated <code>splat.moon</code> to use argparse, added <code>--strip-prefix</code> option</li>
</ul>github-actions[bot]tag:github.com,2008:Repository/1786885/win32-v0.5.02016-09-26T01:22:45Zwin32-v0.5.0No content.leafotag:github.com,2008:Repository/1786885/v0.5.02016-09-26T01:25:06ZMoonScript v0.5.0<p>Windows binary: <a href="https://github.com/leafo/moonscript/releases/tag/win32-v0.5.0">https://github.com/leafo/moonscript/releases/tag/win32-v0.5.0</a></p>
<h2>Syntax updates</h2>
<h3>Function calls</h3>
<p>Function calls with parentheses can now have free whitespace around the<br>
arguments. Additionally, a line break may be used in place of a comma:</p>
<div class="highlight highlight-source-moonscript notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="my_func(
"first arg"
=>
print "some func"
"third arg", "fourth arg"
)"><pre>my_func<span class="pl-en">(</span>
<span class="pl-s"><span class="pl-pds">"</span>first arg<span class="pl-pds">"</span></span>
<span class="pl-k">=></span>
<span class="pl-c1">print</span> <span class="pl-s"><span class="pl-pds">"</span>some func<span class="pl-pds">"</span></span>
<span class="pl-s"><span class="pl-pds">"</span>third arg<span class="pl-pds">"</span></span><span class="pl-k">,</span> <span class="pl-s"><span class="pl-pds">"</span>fourth arg<span class="pl-pds">"</span></span>
<span class="pl-en">)</span></pre></div>
<h3>Function argument definitions</h3>
<p>Just like the function all update, function argument definitions have no<br>
whitespace restrictions between arguments, and line breaks can be used to<br>
separate arguments:</p>
<div class="highlight highlight-source-moonscript notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="some_func = (
name
type
action="print"
) =>
print name, type, action"><pre>some_func <span class="pl-k">=</span> <span class="pl-en">(</span>
name
<span class="pl-c1">type</span>
action<span class="pl-k">=</span><span class="pl-s"><span class="pl-pds">"</span>print<span class="pl-pds">"</span></span>
<span class="pl-en">)</span> <span class="pl-k">=></span>
<span class="pl-c1">print</span> name<span class="pl-k">,</span> <span class="pl-c1">type</span><span class="pl-k">,</span> action</pre></div>
<h2>Additions</h2>
<ul>
<li><code>elseif</code> can be used part of an <code>unless</code> block (nymphium)</li>
<li><code>unless</code> conditional expression can contain an assignment like an <code>if</code> statement (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="139733350" data-permission-text="Title is private" data-url="https://github.com/leafo/moonscript/issues/251" data-hovercard-type="issue" data-hovercard-url="/leafo/moonscript/issues/251/hovercard" href="https://github.com/leafo/moonscript/issues/251">#251</a>)</li>
<li>Lua 5.3 bitwise operator support (nymphium) (Kawahara Satoru)</li>
<li>Makefile is Lua version agnostic (nymphium)</li>
<li>Lint flag can be used with <code>moonc</code> watch mode (ChickenNuggers)</li>
<li>Lint exits with status 1 if there was a problem detected (ChickenNuggers)</li>
<li>Compiler can be used with lulpeg</li>
</ul>
<h2>Bug Fixes</h2>
<ul>
<li>Slice boundaries can be full expressions (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="125576304" data-permission-text="Title is private" data-url="https://github.com/leafo/moonscript/issues/233" data-hovercard-type="issue" data-hovercard-url="/leafo/moonscript/issues/233/hovercard" href="https://github.com/leafo/moonscript/issues/233">#233</a>)</li>
<li>Destructure works when used as loop variable in comprehension (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="126123783" data-permission-text="Title is private" data-url="https://github.com/leafo/moonscript/issues/236" data-hovercard-type="issue" data-hovercard-url="/leafo/moonscript/issues/236/hovercard" href="https://github.com/leafo/moonscript/issues/236">#236</a>)</li>
<li>Proper name local hoisting works for classes again (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="174491568" data-permission-text="Title is private" data-url="https://github.com/leafo/moonscript/issues/287" data-hovercard-type="issue" data-hovercard-url="/leafo/moonscript/issues/287/hovercard" href="https://github.com/leafo/moonscript/issues/287">#287</a>)</li>
<li>Quoted table key literals can now be parsed when table declaration is in single line (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="174435701" data-permission-text="Title is private" data-url="https://github.com/leafo/moonscript/issues/286" data-hovercard-type="issue" data-hovercard-url="/leafo/moonscript/issues/286/hovercard" href="https://github.com/leafo/moonscript/issues/286">#286</a>)</li>
<li>Fix an issue where <code>else</code> could get attached to wrong <code>if</code> statement (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="162191134" data-permission-text="Title is private" data-url="https://github.com/leafo/moonscript/issues/276" data-hovercard-type="issue" data-hovercard-url="/leafo/moonscript/issues/276/hovercard" href="https://github.com/leafo/moonscript/issues/276">#276</a>)</li>
<li>Loop variables will no longer overwrite variables of the same name in the same scope (egonSchiele)</li>
<li>A file being deleted will not crash polling watch mode (ChickenNuggers)</li>
<li>The compiler will not try to compile a directory ending in <code>.moon</code> (Gskartwii)</li>
<li>alt_getopt import works with modern version (Jon Allen)</li>
<li>Code coverage not being able to find file from chunk name</li>
</ul>leafotag:github.com,2008:Repository/1786885/win32-v0.4.02015-12-07T01:03:15Zwin32-v0.4.0No content.leafotag:github.com,2008:Repository/1786885/v0.4.02015-12-07T02:18:43Zv0.4.0<p><strong>You can now find windows binaries through GithHub's releases. See <a href="https://github.com/leafo/moonscript/releases/tag/win32-v0.4.0"><code>win32-v0.4.0</code></a></strong></p>
<h2>Changes to <code>super</code></h2>
<p><code>super</code> now looks up the parent method via the class reference, instead of a<br>
(fixed) closure to the parent class.</p>
<p>Given the following code:</p>
<div class="highlight highlight-source-moonscript notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class MyThing extends OtherThing
the_method: =>
super!"><pre><span class="pl-k">class</span> <span class="pl-c1">MyThing</span> <span class="pl-k">extends</span> <span class="pl-c1">OtherThing</span>
<span class="pl-en">the_method</span><span class="pl-k">:</span> <span class="pl-k">=></span>
<span class="pl-k">super</span>!</pre></div>
<p>In the past <code>super</code> would compile to something like this:</p>
<div class="highlight highlight-source-lua notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="_parent_0.the_method(self)"><pre><span class="pl-smi">_parent_0</span>.<span class="pl-c1">the_method</span>(<span class="pl-c1">self</span>)</pre></div>
<p>Where <code>_parent_0</code> was an internal local variable that contains a reference to<br>
the parent class. Because the reference to parent is an internal local<br>
variable, you could never swap out the parent unless resorting to the debug<br>
library.</p>
<p>This version will compile to:</p>
<div class="highlight highlight-source-lua notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="_class_0.__parent.__base.the_method(self)"><pre><span class="pl-smi">_class_0</span>.<span class="pl-e">__parent</span>.<span class="pl-e">__base</span>.<span class="pl-c1">the_method</span>(<span class="pl-c1">self</span>)</pre></div>
<p>Where <code>_class_0</code> is an internal local variable that contains the current class (<code>MyThing</code>).</p>
<p>Another difference is that the instance method is looked up on <code>__base</code> instead<br>
of the class. The old variation would trigger the metamethod for looking up on<br>
the instance, but a class method of the same name could conflict, take<br>
precedence, and be retuned instead. By referencing <code>__base</code> directly we avoid<br>
this issue.</p>
<h3>Super on class methods</h3>
<p><code>super</code> can now be used on class methods. It works exactly as you would expect.</p>
<div class="highlight highlight-source-moonscript notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class MyThing extends OtherThing
@static_method: =>
print super!"><pre><span class="pl-k">class</span> <span class="pl-c1">MyThing</span> <span class="pl-k">extends</span> <span class="pl-c1">OtherThing</span>
<span class="pl-v">@static_method</span><span class="pl-k">:</span> <span class="pl-k">=></span>
<span class="pl-c1">print</span> <span class="pl-k">super</span>!</pre></div>
<p>Calling <code>super</code> will compile to:</p>
<div class="highlight highlight-source-moonscript notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="_class_0.__parent.static_method(self)"><pre>_class_0<span class="pl-k">.</span>__parent<span class="pl-k">.</span>static_method<span class="pl-en">(</span><span class="pl-c1">self</span><span class="pl-en">)</span></pre></div>
<h3>Improved scoping for super</h3>
<p>The scoping of super is more intelligent. You can warp your methods in other<br>
code and <code>super</code> will still generate correctly. For example, syntax like this<br>
will now work as expected:</p>
<div class="highlight highlight-source-moonscript notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class Sub extends Base
value: if debugging
=> super! + 100
else
=> super! + 10
other_value: some_decorator {
the_func: =>
super!
}"><pre><span class="pl-k">class</span> <span class="pl-c1">Sub</span> <span class="pl-k">extends</span> <span class="pl-c1">Base</span>
<span class="pl-en">value</span><span class="pl-k">:</span> <span class="pl-k">if</span> debugging
<span class="pl-k">=></span> <span class="pl-k">super</span>! <span class="pl-k">+</span> <span class="pl-c1">100</span>
<span class="pl-k">else</span>
<span class="pl-k">=></span> <span class="pl-k">super</span>! <span class="pl-k">+</span> <span class="pl-c1">10</span>
<span class="pl-en">other_value</span><span class="pl-k">:</span> some_decorator <span class="pl-k">{</span>
<span class="pl-en">the_func</span><span class="pl-k">:</span> <span class="pl-k">=></span>
<span class="pl-k">super</span>!
<span class="pl-k">}</span></pre></div>
<p><code>super</code> will refer to the lexically closest class declaration to find the name<br>
of the method it should call on the parent.</p>
<h2>Bug Fixes</h2>
<ul>
<li>Nested <code>with</code> blocks used incorrect ref (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="105031860" data-permission-text="Title is private" data-url="https://github.com/leafo/moonscript/issues/214" data-hovercard-type="pull_request" data-hovercard-url="/leafo/moonscript/pull/214/hovercard" href="https://github.com/leafo/moonscript/pull/214">#214</a> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/geomaster/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/geomaster">@geomaster</a>)</li>
<li>Lua quote string literals had wrong precedence (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="94382795" data-permission-text="Title is private" data-url="https://github.com/leafo/moonscript/issues/200" data-hovercard-type="issue" data-hovercard-url="/leafo/moonscript/issues/200/hovercard" href="https://github.com/leafo/moonscript/issues/200">#200</a> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/nonchip/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/nonchip">@nonchip</a>)</li>
<li>Returning from <code>with</code> block would generate two <code>return</code> statements (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="100419862" data-permission-text="Title is private" data-url="https://github.com/leafo/moonscript/issues/208" data-hovercard-type="issue" data-hovercard-url="/leafo/moonscript/issues/208/hovercard" href="https://github.com/leafo/moonscript/issues/208">#208</a>)</li>
<li>Including <code>return</code> or <code>break</code> in a <code>continue</code> wrapped block would generate invalid code (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="108199450" data-permission-text="Title is private" data-url="https://github.com/leafo/moonscript/issues/215" data-hovercard-type="issue" data-hovercard-url="/leafo/moonscript/issues/215/hovercard" href="https://github.com/leafo/moonscript/issues/215">#215</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="76161505" data-permission-text="Title is private" data-url="https://github.com/leafo/moonscript/issues/190" data-hovercard-type="issue" data-hovercard-url="/leafo/moonscript/issues/190/hovercard" href="https://github.com/leafo/moonscript/issues/190">#190</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="65858552" data-permission-text="Title is private" data-url="https://github.com/leafo/moonscript/issues/183" data-hovercard-type="issue" data-hovercard-url="/leafo/moonscript/issues/183/hovercard" href="https://github.com/leafo/moonscript/issues/183">#183</a>)</li>
</ul>
<h2>Other</h2>
<ul>
<li>Refactor transformer out into multiple files</li>
<li><code>moon</code> command line script rewritten in MoonScript</li>
<li><code>moonscript.parse.build_grammar</code> function for getting new instance of parser grammar</li>
<li>Chain AST updated to be simpler</li>
</ul>leafotag:github.com,2008:Repository/1786885/v0.3.22015-06-02T05:32:36Zv0.3.2<p>version bump</p>leafotag:github.com,2008:Repository/1786885/v0.3.12015-03-07T16:19:10Zv0.3.1<p>version bump</p>leafotag:github.com,2008:Repository/1786885/v0.3.02015-03-01T03:13:16Zv0.3.0<p>fix codeblock language</p>leafotag:github.com,2008:Repository/1786885/v0.2.62014-06-19T07:24:52Zv0.2.6<p>rebuild version</p>leafotag:github.com,2008:Repository/1786885/v0.2.52014-03-05T08:33:18Zv0.2.5<p>bump version 🌛</p>leafo