dreamstack/examples/list.ds
enzotar ca45c688df feat: for-in list rendering + component system
Phase 6 features:
- ForIn reactive list rendering: for item in items -> body
- Optional index binding: for item, idx in items -> body
- Component declarations: component Name(props) = body
- Component instantiation: ComponentUse { name, props }

Added across 5 crates:
- ds-parser: For/In/Component tokens, ForIn/ComponentDecl AST nodes
- ds-codegen: reactive list effect, component function emission
- ds-types: ForIn/ComponentUse type inference
- local_vars tracking for non-reactive for-in loop vars

Includes examples/list.ds showcasing for-in + when + signals.
2026-02-25 01:33:28 -08:00

26 lines
440 B
Text

-- DreamStack List & Component Example
-- Demonstrates for-in reactive lists and reusable components
let items = [
"Learn DreamStack",
"Build a reactive app",
"Deploy to production"
]
let count = 0
view main = column [
text "Task List"
for item in items ->
row [
text item
]
text count
button "+" { click: count += 1 }
button "-" { click: count -= 1 }
when count > 5 ->
text "You clicked a lot!"
]