Naming Rules
Rules that enforce consistent naming conventions across the project.
Rules
| Rule | Default | Effect |
|---|---|---|
enforce_strict_file_naming | true | Filename must match the class name inside it |
min_method_name_length | 4 | Minimum method name characters |
require_const_uppercase | true | const variables must use UPPER_CASE |
Method names are always PascalCase
All method names must start with an uppercase letter (PascalCase convention):
CalculateSum method(a as int, b as int) as int { } // ✅
calculateSum method(a as int, b as int) as int { } // ❌ rejected
Why: PascalCase distinguishes methods from variables at a glance:
player is GetActivePlayer(); // GetActivePlayer = method (uppercase)
score is player.score; // score = field (lowercase)
enforce_strict_file_naming = true
Three rules enforced together:
- Filename starts uppercase:
player.mx❌ →Player.mx✅ - No underscores:
my_class.mx❌ →MyClass.mx✅ - Class name matches filename:
Warrior.mxwithFighter classinside ❌
morphc: error: Invalid .mx filename 'player.mx': filename must start
with an uppercase letter.
morphc: error: Invalid .mx filename 'my_class.mx': filename cannot
include '_'.
morphc: error: Class name must match module filename.
Expected: Warrior Found: Fighter
Why: O(1) class lookup. You can find any class by its filename — no searching necessary. Critical for both humans and AI agents navigating the project.
min_method_name_length = 4
Method names must be at least 4 characters:
Init method() { } // ✅ (4 characters)
Run method() { } // ❌ (3 characters — too short)
Go method() { } // ❌ (2 characters — too short)
Why: Prevents meaningless abbreviations like fn(), do(), op(). Method names should describe what they do.
require_const_uppercase = true
Constants must use UPPER_CASE naming:
const MAX_SPEED is 100; // ✅
const maxSpeed is 100; // ❌ rejected
Why: Constants stand out visually from regular variables, making code easier to scan.