quad/.claude/audit/handtrace-round10-reference-impl/spikes/t13_ref_dedup.luau
qwreey d2d67c7aeb
qa: 10라운드 광범위 탐사 완료 — 발견 H-150~H-157 (🔴 0 / 🟡 5 / 🟢 3), §4 배치 문항 7건 회신 대기
- 신선한 탐사자(fable) 단일 컨텍스트, 지시서 -round10-brief.md §2 레인 A·C 완료, B 부분, D ALL PASS
- audit/handtrace-round10-reference-impl/: round7 참조 구현을 현재 계약으로 갱신·재실행
  (부수: round7/ref9 _recompute 첫 인자 오류 발견·정정)
- base/·인덱스 레이어는 미변경 — 결정은 사용자 배치 회신 뒤 -round10-followup.md로

Co-authored-by: qwreey <me@qwreey.moe>
Claude-Session: https://claude.ai/code/session_01546hjsYNLSMZdHdPyTZaGb
2026-08-28 01:03:05 +09:00

20 lines
868 B
Text

--!nocheck
local q = require("./core9")
local r = q.Ref(nil)
local calls = {}
local function fn(v, ref) table.insert(calls, tostring(v) .. "/" .. tostring(ref == r)) end
r:WeakCallback(fn); r:Callback(fn) -- 같은 fn을 약·강 양쪽에
print("등록 즉시 호출:", table.concat(calls, ","), "(기대 nil/true 두 번 — 등록마다 1회)")
calls = {}
r:Set(7)
print("Set(7) 후 호출:", table.concat(calls, ","), "(기대 7/true 한 번 — 교차 dedup)")
r:Uncallback(fn); calls = {}
r:Set(8)
print("Uncallback 뒤 Set(8):", #calls, "회 (기대 0)")
-- thread 대기자 + 값→리비전→콜백 순서
local seenRev
local co = coroutine.create(function(ref) seenRev = ref.Revision end)
r.Callbacks[co] = true
local rev0 = r.Revision
r:Set(9)
print("thread가 본 Revision ~= 옛 리비전:", seenRev ~= rev0, "| 소진됨:", r.Callbacks[co] == nil)