| name | moonbit-deprecated-syntax |
| description | Tracks deprecated MoonBit syntax to avoid generating invalid code. Reference this before writing MoonBit code. Auto-maintained when deprecated patterns are discovered. |
MoonBit Deprecated Syntax Reference
Reference this skill before generating MoonBit code to avoid deprecated patterns.
Deprecated Patterns
Error Propagation: ! suffix (DEPRECATED)
Old syntax (deprecated):
let result = may_fail()! // WRONG: ! suffix
Current syntax:
// Automatic propagation when caller also declares `raise`
fn caller() -> T raise E {
let result = may_fail() // Errors propagate automatically
}
// Or explicit try/catch
try {
may_fail()
} catch {
e => handle(e)
}
Labeled Arguments: ~ prefix vs suffix
Old syntax (deprecated):
fn foo(~label : Int) -> Unit // WRONG: ~ prefix
foo(~label=42) // WRONG: ~ prefix in call
Current syntax:
fn foo(label~ : Int) -> Unit // Correct: ~ suffix
foo(label~=42) // Correct: ~ suffix in call
foo(label=42) // Also valid without ~
Maintenance
When the AI generates code that fails due to deprecated syntax:
- Add the deprecated pattern to this file
- Include the old (wrong) and new (correct) syntax
- Add a brief explanation
This file is the source of truth for deprecated MoonBit patterns in this project.