Files
marqdo/public/structure/09-inherit.mq.md
T
cflmyandCursor 5456d9ff83 Implement object inheritance: # Child = > Parent (I0-I2)
- Parse `# Child = > Parent` object decls (base must be a simple
  name after `>`; dotted bases and `# Foo = 1` are diagnostics).
- Validate in load: unknown base types and cyclic inheritance (A → B → A)
  fail with line/col.
- Method resolution walks the base chain (most specific first) on both
  tree and bytecode backends; `_type` stays the child name; same-name
  child ## overrides the parent.
- Add inherit.rs, wire Program.object_bases, gold fixtures
  (inherit-parent-method / inherit-override + cycle/unknown-base/bad-rhs)
  and public 09-inherit demo pages. Docs: objects.md, markdown-mapping,
  roadmap, skill.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-10 10:01:05 +08:00

30 lines
390 B
Markdown

---
title: Object inheritance
description: "# Child = > Parent; methods walk the base chain"
---
# Greeter
## hello
+ `who`
*`msg` = "Hello, `who`!" *
**`msg`**
# Loud = > Greeter
## hello
+ `who`
*`msg` = "HELLO, `who`!" *
**`msg`**
# main
*`g` = > Greeter *
*`m` = > `g`.hello who=world *
> print text=`m`
*`l` = > Loud *
*`m2` = > `l`.hello who=world *
> print text=`m2`