-
Notifications
You must be signed in to change notification settings - Fork 195
Open
Labels
syntax proposalProposed changes to MoonScript syntaxProposed changes to MoonScript syntax
Description
Current Behavior
Currently, ; is only valid as an alternative to , in a few specific contexts (ExpListLow):
- Return statements:
return a; b - Assignments:
x = a; b - Exports:
export x = a; b
This was introduced in 2011 as a "value separator" to help disambiguate from function calls, but it's an obscure feature that few users likely know about or use.
Proposal
Remove the current ; behavior and repurpose it as a statement separator, allowing multiple statements on a single line while preserving the current indentation level. This would align with Lua's syntax.
Examples
-- Simple one-liners
x = 1; y = 2
-- Short related statements
i += 1; j += 1In block contexts
The semicolon would maintain the current indentation:
if condition
setup!; run!; cleanup!Equivalent to:
if condition
setup!
run!
cleanup!Breaking Changes
This removes the ability to use ; as a value separator in return/assignment/export. Users would need to switch to ,:
-- No longer valid
return a; b
-- Use instead
return a, bThis usage is likely rare since , works identically and is more conventional.
Metadata
Metadata
Assignees
Labels
syntax proposalProposed changes to MoonScript syntaxProposed changes to MoonScript syntax