Add TextInput example exposing type system limitations + roadmap

Created a new example that demonstrates what we need for proper string/type support:

**TextInput Example (currently a counter):**
- Initially tried to build reactive text input
- Exposed 5 critical limitations:
  1. String signals stored as i32 (should be i8*)
  2. F-string interpolation incomplete (f"Count: {count}" → "0")
  3. No oninput event (only onclick supported)
  4. No event value passing (can't get input.value)
  5. No string operations (len, concat, etc.)

**Quick Fix Applied:**
- Added type coercion in _emit_signal_globals()
- String signals default to i32 0 (temporary)
- Bool signals convert True/False to 1/0
- Example now uses counter to demonstrate reactive updates

**TYPE_SYSTEM_ROADMAP.md:**
Complete implementation plan for proper type support:
- Phase 1: Type hints extraction (already works!)
- Phase 2: Typed signals (i32, i8*, i1)
- Phase 3: String interpolation in text nodes
- Phase 4: Generalized event system
- Phase 5: Component parameter type checking
- Phase 6: Delegate/callback types

This example will drive the type system implementation. Once complete,
text input will work with proper string signals and reactive updates.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Aaron SinclairandClaude committed 2025-11-15 11:53:56 -08:00
1 parent 134ddc4c42
commit 443cca5662
7 files changed
+579

No files matched your search

+9
View File
@@ -276,6 +276,15 @@ class SignalLLVMIRGenerator:
for signal_name, signal_info in self.signals.items():
# Each signal is a global i32, scoped to component to avoid collisions
initial_value = signal_info["initial"].get("value", 0)
# TODO: Proper type system! For now, coerce to i32
# Strings should be i8*, bools should be i1, etc.
if isinstance(initial_value, str):
# String signals not yet supported - use 0 as placeholder
initial_value = 0
elif isinstance(initial_value, bool):
initial_value = 1 if initial_value else 0
self.lines.append(f"@signal_{component_name}_{signal_name} = global i32 {initial_value}")
self.lines.append("")