Child of #531 (S2). Fast-follow from #686.
#686 landed TestNoNewShadowedHandRegistrations, which pins the set of names registered twice: once by hand in installLangNS, once by a //lg:native decl in native_prims.go. The generated registrar drains after installLangNS, so it takes the var root and the hand-written closure never runs. That list is a ratchet against new duplicates; it does not resolve the existing ones.
Twelve names are on it:
| name |
hand registration in lang.go |
generated decl |
conj |
ns.Def("conj", conj) |
Conj |
deref |
ns.Def("deref", deref) |
Deref, Deref3 |
get |
ns.Def("get", get) |
Get, Get3 |
int |
ns.Def("int", intf) |
Int |
name |
ns.Def("name", name) |
Name |
namespace |
ns.Def("namespace", namespace) |
Namespace |
nth |
ns.Def("nth", nthf) |
Nth, Nth3 |
pop-binding! |
ns.Def("pop-binding!", popBinding) |
PopBinding |
push-binding! |
ns.Def("push-binding!", pushBinding) |
PushBinding |
some |
ns.Def("some", some) |
Some |
str |
ns.Def("str", str) |
Str |
subs |
ns.Def("subs", subs) |
Subs, Subs3 |
Why close them
reduce was the thirteenth. Its two bodies had drifted: the closure carried an ArrayVector fast path, a Range fast path, and a reused argument buffer that the //lg:native decl never got. When #639's namespace-alias fix made the generated registration resolve for the first time, reduce silently switched to the naive body and got 1.88x slower, with no diff to reduce and no failing test. TestReduceRangeFastPath stayed green: it asserts results, not which path produced them (#656).
A second copy that nothing executes has no pressure keeping it honest.
What the audit found
All twelve pairs were compared body for body during #686. The //lg:native decls are faithful ports, several carrying the closure's comments verbatim. No name is losing behavior today, so this is deletion work rather than porting work, and it can go at whatever pace suits.
Shape of the work
Per name, or per small family:
- Delete the
ns.Def site.
- Delete the Go func it referenced, once nothing else calls it.
- Drop the name from
knownShadowedHandRegistrations.
The ratchet keeps the list honest in both directions: a new duplicate fails the test, and a listed name that is no longer double-registered fails it too, so the list cannot go stale.
Done when the accepted set is empty and the test asserts emptiness directly.
Gate
ns-publics diff empty, pkg/rt green under go test -count=2. The failure mode to watch for is deleting a var's only surviving registration, which the ns-publics diff catches.
Child of #531 (S2). Fast-follow from #686.
#686 landed
TestNoNewShadowedHandRegistrations, which pins the set of names registered twice: once by hand ininstallLangNS, once by a//lg:nativedecl innative_prims.go. The generated registrar drains afterinstallLangNS, so it takes the var root and the hand-written closure never runs. That list is a ratchet against new duplicates; it does not resolve the existing ones.Twelve names are on it:
lang.goconjns.Def("conj", conj)Conjderefns.Def("deref", deref)Deref,Deref3getns.Def("get", get)Get,Get3intns.Def("int", intf)Intnamens.Def("name", name)Namenamespacens.Def("namespace", namespace)Namespacenthns.Def("nth", nthf)Nth,Nth3pop-binding!ns.Def("pop-binding!", popBinding)PopBindingpush-binding!ns.Def("push-binding!", pushBinding)PushBindingsomens.Def("some", some)Somestrns.Def("str", str)Strsubsns.Def("subs", subs)Subs,Subs3Why close them
reducewas the thirteenth. Its two bodies had drifted: the closure carried an ArrayVector fast path, a Range fast path, and a reused argument buffer that the//lg:nativedecl never got. When #639's namespace-alias fix made the generated registration resolve for the first time,reducesilently switched to the naive body and got 1.88x slower, with no diff toreduceand no failing test.TestReduceRangeFastPathstayed green: it asserts results, not which path produced them (#656).A second copy that nothing executes has no pressure keeping it honest.
What the audit found
All twelve pairs were compared body for body during #686. The
//lg:nativedecls are faithful ports, several carrying the closure's comments verbatim. No name is losing behavior today, so this is deletion work rather than porting work, and it can go at whatever pace suits.Shape of the work
Per name, or per small family:
ns.Defsite.knownShadowedHandRegistrations.The ratchet keeps the list honest in both directions: a new duplicate fails the test, and a listed name that is no longer double-registered fails it too, so the list cannot go stale.
Done when the accepted set is empty and the test asserts emptiness directly.
Gate
ns-publicsdiff empty,pkg/rtgreen undergo test -count=2. The failure mode to watch for is deleting a var's only surviving registration, which thens-publicsdiff catches.