Skip to content

Go encapsulation counts every lowercase symbol: 72% of a Go DOOM port lands in the encapsulation archetypes (C original 2%) #5897

Closed

Description

@squid-protocol

Finding (DOOM study calibration, #5620)

Go's encapsulation rule counts every lowercase top-level symbol (go.py: ^func\s+(?:\([^)]*\)\s+)?[a-z]… and ^(type|var|const)\s+[a-z]…). keyword-rosetta ledgers this as intended visibility morphology (visibility-morphology-encapsulation, engine-semantic, validated 2026-08-31) and warns that "cross-language encapsulation comparisons must expect these to run structurally hot". On real translated code the effect is no longer a footnote. It decides the function archetypes the engine reports for Go.

Measurements at engine 9f213ab83, licensed DOOM ports, functions of at least 3 lines:

port language functions with an encapsulation hit hits / 100 LOC in the two encapsulation archetypes¹ Compute Cores
linuxdoom (original) C 5% 0.21 1.9% 34.3%
doom-scheme (translation) Scheme n/a n/a 1.5% 34.2%
gore (translation) Go 94% 3.09 71.8% 4.3%
dartdoom (translation) Dart 37% 1.54 31.3% 20.3%

¹ Encapsulated Accessors + Stateful Encapsulated Methods (k=14 function model).

gore keeps linuxdoom's call wiring (77% of linuxdoom's calls survive between the corresponding functions; structural-fingerprint-scanner subway maps, population-analyses examples/doom/), so the algorithm is the same. Yet nearly three quarters of its functions, renderer and playsim included, are labelled as encapsulation archetypes. Seven of gore's nine package clauses are package main, and 950 of its 1,025 func declarations are lowercase. In a main package nothing can be imported, so a lowercase name is not a visibility decision at all. The keyword-rosetta control shows the same skew on the identical planted program: def_encapsulation C 0, Java 0, Dart 0, C++ 0, Go 3.75, Rust 3.

Fixture (our own code, not from any port):

package main

func renderColumn(x int) int { // lowercase: counted as encapsulation today
	return x * 2
}

func main() {
	renderColumn(3)
}

Options

  1. Rule: in a package main file, lowercase declarations carry no visibility meaning, so don't count them. Optionally count only unexported methods and types in library packages. This is the smallest semantic fix.
  2. Model: keep the rule, but have the function-archetype classifier down-weight def_encapsulation for languages ledgered under visibility morphology (go, perl, and rust if confirmed), so the archetype labels stop tracking spelling.
  3. Leave it: document in the archetype docs that Go archetype mixes are not comparable with other languages.

Recommendation: option 1, which stays faithful to the ledger's "correct morphology" (library packages still count), then re-measure. If Go archetype mixes still diverge on translations that keep the original's wiring, do option 2 as well. Check Rust's rule against the same question (rosetta 3 vs 0).

Acceptance

  • The fixture above: 0 encapsulation hits in package main; a library-package variant still counts its unexported functions (test).
  • gore's encapsulation-archetype share re-measured and posted here (target: within ~10 points of the C original's, or the residual explained).
  • keyword-rosetta visibility-morphology-encapsulation updated (Go expected counts re-locked), and goldens re-blessed with the drift explained.

Part of #5457; calibration finding for #5620. Data: structural-fingerprint-scanner per-subsystem view (gitgalaxy-population-analyses PR #19).

Activity

  1. added
    scope:frontierMapped, not yet built: eras/commands/regions the burned estates don't use (Gap Atlas)
    scope:coreBlocks a burned-estate program's next evidence rung, or the 4th-estate one-shot trial
    and removed
    scope:frontierMapped, not yet built: eras/commands/regions the burned estates don't use (Gap Atlas)
    on Oct 22, 2026
  2. squid-protocol commented on Oct 26, 2026

    @squid-protocol
    OwnerAuthor

    Churn run 5897-20261026T0338Z (host nyx) ended without a PR. Reviewed: keyword-rosetta#164 (draft, 2 files: Go main.go encapsulation 1->0 + ledger UPDATE) matches #6701 package-main filter; verify_language go PASS per worker. No gitgalaxy PR. Perl/Rust weights left for rosetta to measure.

  3. squid-protocol commented on Oct 26, 2026

    @squid-protocol
    OwnerAuthor

    Claimed by promoter-bot host nyx, lease renewed 2026-10-26T14:42Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove the claim:nyx label.

  4. squid-protocol commented on Oct 26, 2026

    @squid-protocol
    OwnerAuthor

    Acceptance met on origin/main (churn re-measure): gore encapsulation-archetype share 0.0% vs 1.9% for linuxdoom; fixture/rosetta/goldens landed via #6701, #6707, keyword-rosetta#164. Perl/Rust notes are not defects here.

  5. squid-protocol commented on Oct 26, 2026

    @squid-protocol
    OwnerAuthor

    Churn run 5897-20261026T1537Z (host nyx) ended without a PR. Acceptance met; issue closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claim:nyxscope:coreBlocks a burned-estate program's next evidence rung, or the 4th-estate one-shot trial

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions