- 신선한 탐사자(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
28 lines
1.1 KiB
Text
28 lines
1.1 KiB
Text
--!strict
|
|
type function CheckReservedKeys(keys: type)
|
|
if keys:is("never") then print("keys is never") return types.singleton(true) end
|
|
local list = if keys:is("union") then keys:components() else {keys}
|
|
for _, k in list do
|
|
if k:is("singleton") and (k:value() == "Of" or k:value() == "Names" or k:value() == "__reservedCheck") then
|
|
print(`quad.Store: "{k:value()}" is a reserved key`)
|
|
return types.never
|
|
end
|
|
end
|
|
return types.singleton(true)
|
|
end
|
|
type Source<T> = { Get: (self: any) -> T, Set: (self: any, T) -> () }
|
|
type Store<T> = T & {
|
|
Of: <U>(self: any, name: string) -> Source<U>,
|
|
Names: (self: any) -> { string },
|
|
__reservedCheck: CheckReservedKeys<keyof<T>>,
|
|
}
|
|
local function Store<T>(defaults: T?): Store<T> return (nil :: any) end
|
|
-- 빈 Store
|
|
local empty = Store({} :: {})
|
|
local _n1: { string } = empty:Names()
|
|
-- 키 있는 Store (양성)
|
|
local st = Store({ hp = (nil :: any) :: Source<number> })
|
|
local _h: number = st.hp:Get()
|
|
-- 음성 대조군
|
|
local bad = Store({ Of = (nil :: any) :: Source<number> })
|
|
local _o = bad.Names
|