- compiler: `insert Class { ... }` is a typed Ast.Insert in statement
AND expression position, sharing the ctor literal's field grammar;
typechecked with the ctor's omittable rule; result = the row id (Int)
- owner pass: the engine copies at the row API, so an insert BORROWS
its field values -- no transfer, no E304; node is trap-capable and
carries a live-mask drop entry like DbStub did
- emit: builtin 61 window = class-id const + one slot per DECLARED
field in declaration order; omitted defaults emitted, omitted ?scalar
gets WO_NIL_SCALAR, other omitted optionals the zero word; fresh
argument values reaped after (the push/set copy semantics)
- runtime: database/src/db.c executes via the choke-point row API;
rt.db/rt.wal opaque handles on wo_rt; WO_DATA=<dir> = replay
<dir>/shard-0.wal at boot + commit-before-ack per statement (the
builtin's return IS the ack until iteration 8 ticks); failed commit
un-applies the row and traps WO_T_IO; loader validates the class-id
slot (variable window documented in wob.h + format doc)
- the promised diff: trap/pricing-set-price-db-stub is now
run/pricing-set-price-insert printing engine-allocated ids;
durability smoke prints 1,2 then 3,4 across two WO_DATA runs
- old "bare insert is an Ident" unit test rewritten to the new
contract; runner's loader mirror accepts id 61; goldens re-blessed
- gates: oop-accept ALL CRITERIA MET, oop-e2e 71/0, woc-test 566/0,
wovm-test green, log-watcher 7/0
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
69 lines
1,001 B
Text
69 lines
1,001 B
Text
class Item {
|
|
n: Int
|
|
}
|
|
|
|
fn size(it: Item) -> Int {
|
|
return it.n
|
|
}
|
|
|
|
class Bag {
|
|
items: multi Item
|
|
|
|
fn tidy(take spare: Item, flag: Bool) {
|
|
let extra = Item { n: 2 }
|
|
if flag {
|
|
let inner = Item { n: 3 }
|
|
spare = inner
|
|
}
|
|
while flag {
|
|
let tick = Item { n: 4 }
|
|
}
|
|
for it in self.items {
|
|
let seen = Item { n: 5 }
|
|
}
|
|
}
|
|
}
|
|
|
|
fn pick(take a: Item, take b: Item, flag: Bool) -> Int {
|
|
let total = 0
|
|
if flag {
|
|
let tmp = Item { n: 1 }
|
|
total = total + size(tmp)
|
|
}
|
|
if total > 0 {
|
|
return total
|
|
}
|
|
total = total + size(a)
|
|
return total
|
|
}
|
|
|
|
fn store(take r: Item) -> Int {
|
|
insert Row { n: 1 }
|
|
return 0
|
|
}
|
|
|
|
fn eat(take it: Item) -> Int {
|
|
return 0
|
|
}
|
|
|
|
fn conditional_move(take a: Item, flag: Bool) -> Int {
|
|
if flag {
|
|
let gone = eat(a)
|
|
}
|
|
return 0
|
|
}
|
|
|
|
fn self_assign(take a: Item) -> Int {
|
|
a = a
|
|
return 0
|
|
}
|
|
|
|
fn reinit_after_move(take a: Item) -> Int {
|
|
let gone = eat(a)
|
|
a = Item { n: 7 }
|
|
return 0
|
|
}
|
|
|
|
class Row {
|
|
n: Int
|
|
}
|