`List` and `Map` are currently special — the `[]` and `[key: val]` literals emit special `__lz_list` / `__lz_map` constructors, and HOFs like `map`, `filter`, and `fold` are static functions that take the collection as their first argument.
Converting them to proper classes would fix several things at once:
- Method dispatch via the class table (`xs.map(f).filter(g)` instead of nesting)
- Generics work correctly at the type level
- The type system can reason about `List` and `Map<K,V>` without special-casing them
Additional methods worth adding when this lands: `reverse()`, `sort()`, `sort_by(f)` on List; `entries()`, `merge(other)` on Map.
This is a significant change that touches the lexer (literal syntax), typechecker (special-cased types), and codegen (list/map construction and dispatch).
`List` and `Map` are currently special — the `[]` and `[key: val]` literals emit special `__lz_list` / `__lz_map` constructors, and HOFs like `map`, `filter`, and `fold` are static functions that take the collection as their first argument.
Converting them to proper classes would fix several things at once:
Additional methods worth adding when this lands: `reverse()`, `sort()`, `sort_by(f)` on List; `entries()`, `merge(other)` on Map.
This is a significant change that touches the lexer (literal syntax), typechecker (special-cased types), and codegen (list/map construction and dispatch).