User Request: Apply the same 4 features implemented for WokeLang to Error-Lang.
The 4 WokeLang Features:
- Record field access with dot notation
- Full stdlib integration with interpreter
- Worker message passing
- Enhanced error messages with hints
Project Status: 45% complete (Alpha - Foundation Complete) Language: Pedagogical language with intentional fragility and paradoxes Tech Stack:
- Compiler: ReScript
- Runtime: Deno (JavaScript)
- Verification: Idris2 (planned)
Core Language Features:
- ✅ Lexer, Parser, AST (ReScript compiler)
- ✅ Runtime interpreter (Deno/JS)
- ✅ Stability tracking system (computational haptics)
- ✅ 7/10 paradoxes implemented
- ✅ Five Whys root cause analysis
- ✅ Layer navigation (Grammar → AST → Semantics → Runtime)
- ✅ Visual feedback system (animated stability bar)
AST Support (from Types.res):
- ✅
Member(expr, string, location)- Field access defined - ✅
StructDecl- Struct declarations defined - ✅
Structkeyword exists - ✅
Dotoperator exists - ✅ Diagnostics with
hint: option<string>field
Status: AST defined, need to verify runtime implementation
What's defined in AST:
- Types.res line 114:
Member(expr, string, location)- field access - Types.res line 171:
StructDecl- struct declarations - Types.res line 26:
Structkeyword - Types.res line 85:
Dottoken
Need to check:
- Is
Memberexpression evaluated in runtime.js? - Can you create struct instances?
- Can you access fields with dot notation?
Action required: Test with example program and implement if missing
Status: Need to investigate
Error-Lang appears to have built-in functions (print, println, stability()) but no formal stdlib system like WokeLang.
Evidence:
- Examples use
println(),stability() - No stdlib directory found
- No
Std.*module calls in examples
Questions:
- Are there builtin functions beyond print/println?
- Is there a planned stdlib?
- What functions would make sense for a pedagogical language?
Recommendation: Error-Lang is a pedagogical language, not general-purpose. Stdlib should be minimal and educational:
- Stability tracking functions (already has)
- Diagnostic helpers
- Basic I/O (print/println)
- No need for 96 functions like WokeLang
Action required: Document existing builtins, add any missing core functions
Status: Not applicable (pedagogical language)
Reasoning: Error-Lang is designed to teach systems thinking through paradoxes and instability, not general-purpose concurrent programming.
Language design conflicts:
- Adding workers would introduce concurrency complexity
- Paradoxes are about sequential execution consequences
- Stability tracking assumes deterministic execution
- Educational focus is on cause-and-effect, not parallelism
Recommendation: Do not add workers - incompatible with pedagogical mission
Status: Infrastructure exists, needs implementation
What's defined:
- Types.res line 196-202:
diagnostictype withhint: option<string> - Types.res line 184-194: Error codes E0001-E0010
- Types.res line 282-286:
formatDiagnosticfunction
What's missing:
- Hints not populated (always
Nonein parser) - No suggestion engine
- No "did you mean...?" for typos
- No Levenshtein distance matching
Comparison to Phronesis:
- Phronesis: 967+ lines of comprehensive diagnostics
- Error-Lang: Basic diagnostic structure, minimal implementation
Action required:
- Add hint population to parser error handling
- Create suggestion engine for common mistakes
- Add educational hints for paradox discovery
- Context-aware error messages
Educational hints examples:
Error: Variable 'x' changed type from Int to String
Hint: This is Type Quantum Superposition! Variables in Error-Lang can exist
in multiple types until observed. This teaches how type systems work.
| Feature | WokeLang | Error-Lang Status | Work Needed |
|---|---|---|---|
| 1. Record field access | ✅ Complete | Verify + possibly implement | |
| 2. Stdlib integration | ✅ 96 functions | Add educational builtins | |
| 3. Worker concurrency | ❌ Not applicable | None - don't add | |
| 4. Enhanced error messages | Implement hints + suggestions |
Why: Core to pedagogical mission Work:
- Add hint population in Parser.res error handling
- Create paradox-specific error messages
- Add "what you're discovering" explanations
- Implement suggestion engine for typos
Why: Basic language feature Work:
- Test struct creation and field access
- Implement runtime evaluation if missing
- Add examples showing struct usage
- Document struct syntax
Why: Enhance teaching capabilities Work:
- Document existing builtins (println, stability, etc.)
- Add diagnostic helpers (getDriftMagnitude, getCascadePath)
- Add educational introspection functions
- Keep minimal - this is not a production language
Why: Incompatible with educational focus Reasoning: Error-Lang teaches consequence propagation in sequential code, not concurrency
WokeLang:
- General-purpose programming language
- Needs full stdlib (96 functions)
- Workers make sense for concurrent programming
- Type inference engine with polymorphism
Error-Lang:
- Pedagogical language with intentional fragility
- Minimal stdlib (10-15 educational functions)
- Workers would obscure learning goals
- Stability tracking and paradox detection
Total implementation time: Much less than WokeLang session
Breakdown:
- Enhanced error hints: ~2-3 hours (main work)
- Verify/complete field access: ~1 hour
- Educational stdlib: ~1-2 hours
- Documentation: ~1 hour
Total: ~5-7 hours vs. WokeLang's ~8-10 hours
Simpler because:
- No complex type inference system to fix
- No thread-safety concerns
- Smaller scope (pedagogical vs general-purpose)
- AST already has field access defined
- Diagnostic infrastructure exists
- Investigate runtime.js - Check if
Memberexpression is evaluated - Test struct field access - Create example program
- Implement error hints - Add educational context to diagnostics
- Document builtins - What functions exist and what they do
- Create educational stdlib - Minimal set of teaching-focused functions
ERROR-LANG-ANALYSIS.md- Detailed implementation planexamples/10-struct-fields.err- Test struct field accessdocs/Builtins.adoc- Document existing functions- Updated
Parser.res- Add hint population - Updated
runtime.js- Ensure Member evaluation works