Add deftype and defeffect to SX type system (Phases 6-7)
Phase 6 — deftype: named type aliases, unions, records, and parameterized types. Type definitions stored as plain dicts in *type-registry*. Includes resolve-type for named type resolution, substitute-type-vars for parameterized instantiation, subtype-resolved? for structural record subtyping, and infer-type extension for record field type inference via get. Phase 7 — defeffect: static effect annotations. Effects stored in *effect-registry* and *effect-annotations*. Supports :effects keyword on defcomp and define. Gradual: unannotated = all effects, empty list = pure. check-body-walk validates effect containment at call sites. Standard types defined: (maybe a), type-def, diagnostic, prim-param-sig. Standard effects declared: io, mutation, render. 84/84 type system tests pass. Both Python and JS bootstrappers succeed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -575,6 +575,11 @@ def strip_prefix(s, prefix):
|
||||
return s[len(prefix):] if s.startswith(prefix) else s
|
||||
|
||||
|
||||
def debug_log(*args):
|
||||
import sys
|
||||
print(*args, file=sys.stderr)
|
||||
|
||||
|
||||
def error(msg):
|
||||
raise EvalError(msg)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user