E11026: references not in alphabetical order - reorder for consistency
What went wrong
The 'references' block contains module references that are not in alphabetical order. EK9 requires references to be sorted alphabetically for consistency and readability.
WHY ALPHABETICAL ORDER?
- FASTER SCANNING: Developers can quickly find or verify a reference exists
- REDUCED MERGE CONFLICTS: Alphabetical order minimizes VCS conflicts
- AI-FRIENDLY: Consistent patterns help AI tools understand and generate code
- PROFESSIONAL STANDARD: Industry tools (IDEs, linters) enforce import ordering
EXAMPLE (Error):
references com.example.util.Helper // ✗ 'util' comes after 'service' alphabetically com.example.service.Client // ✗ Out of order com.example.data.Model // ✗ Out of order
EXAMPLE (Correct):
references com.example.data.Model // ✓ 'data' comes first com.example.service.Client // ✓ 'service' comes next com.example.util.Helper // ✓ 'util' comes last
To fix
Reorder your references alphabetically by the full qualified name (case-insensitive).
Sorting rules
- Compare full qualified names (e.g., 'com.example.data.Model')
- Case-insensitive comparison
- Shorter prefixes come before longer ones
- Numbers sort before letters
Automation
Most IDEs can auto-sort imports/references. AI assistants can also reorder for you.
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E11026: references not in alphabetical order - reorder for consistency
#!ek9 defines module error.e11026.bad references org.ek9.lang::String org.ek9.lang::Integer defines function describe() -> count as Integer <- rtn as String: $count
Fixed: List the references in alphabetical order
#!ek9 defines module error.e11026.good references org.ek9.lang::Integer org.ek9.lang::String defines function describe() -> count as Integer <- rtn as String: $count