Skip to content

Activate the std fallback tier: implicit standard-library availability (name-resolution D) #752

Open

Description

@ehartford

Filed per D29 (docs/decisions.md) — blocked on #751 (canonical module-qualified identity). The ruling text is recorded verbatim in D29; spec §18.2 states the destination model. This issue is the activation of that model.

Scope (from the ruling)

  • Enable the fallback tier: every public std declaration available by its unqualified name as the lowest-priority resolution tier. Fallback declarations retain canonical module identity — lookup fallback, never injection into the module's declaration table.
  • Precedence (highest to lowest): lexical bindings and generic parameters → current-module declarations → explicit imports/aliases → prelude → unique std fallback. A user-controlled declaration is never shadowed, merged, or impl-captured by the tier.
  • Exact matching only. Two or more std candidates for one name is a hard ambiguity error with each candidate offered as an insertable-import fix-it; context-aware ranking may order suggestions but never resolves.
  • impl/extend-header restriction: a non-prelude std name may not resolve through fallback alone in an impl/extend header — explicit import or qualified path required.
  • Compatibility invariant: a std addition may turn a unique fallback resolution into an ambiguity, but may never rebind an existing resolution.
  • with update records prior fallback resolutions and inserts pinning imports as a reviewable migration. Hard requirement: ships with or before the tier — our shim-batch releases mint ambiguities.
  • Observability: with explain-name / resolved-path-on-hover.
  • Migrator/formatter removes use lines that become redundant, including the ones the A user Option/Result displaces std's generic templates in the compiler's own lookups #750 scaffolding fix-it inserted.
  • Un-quarantine the D acceptance corpus (the import-free behavior-test originals forked during A user Option/Result displaces std's generic templates in the compiler's own lookups #750 work item 1) as the activation test.
  • The migrator targets std shims where coverage exists; otherwise it emits an explicit engine dependency + qualified calls, and logs those emitted engine paths as the shim-priority worklist.

Rejected (do not build, do not re-propose)

Option C or any migrate-only/lean-prelude build mode; prelude-list expansion; fuzzy or ranked resolution; any "surprising symbol" lint or second curation surface in tooling; flat injection in any form.

Escalate to Eric, don't decide

Any change to the D29 ruling text; any new normative spec wording; anything that would make fallback resolution order-dependent or ranking-dependent; the shim naming policy for common nouns (Connection/Config/Error) when it first bites.

Activity

  1. ehartford commented on Sep 23, 2026

    @ehartford
    ContributorAuthor

    Bridge until this lands: #1377 (Sema.std_fallback_bridge_path) resolves an unimported name to its unique public non-engine std declaration only when an engine corpus twin used to make it reachable over the prelude edge (is_alnum & co.). Engine corpora (std.re/zl/tommyds/c_algorithms) are never ambient per §18.2. Remove the bridge when tier 5 activates.

  2. 1 remaining item

  3. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25, with v0.15.3.0 (main a261b65): still reproduces. §18 states the tier ("Every public declaration of the standard library is available by its unqualified name as the lowest-priority resolution tier"), and the compiler refuses an unimported std function:

    let x: i64 = parse("12")
    
    error: 'parse' requires an explicit import (§18.1); add: use std.string.parse
    

    post-release: blocked on #751 (canonical identity); the diagnostic names the exact use, so the cost to a user is one line.

  4. added this to the post-v0.16.0 milestone on Oct 28, 2026
  5. ehartford commented on Nov 2, 2026

    @ehartford
    ContributorAuthor

    Ceremony audit 2026-11-02 (Eric: "what other plainly wrong decisions have we implemented"): this is the first item, and it is non-compliance, not a decision to brief.

    Verified today with the pinned seed:

    let m: HashMap[str, i32] = HashMap.new()
    
    error: 'HashMap' requires an explicit import (§18.1); add: use std.collections.HashMap
    

    Spec §18.1 tier 5 ("Unique standard-library fallback") has ruled since D29 (2026-08-01) that a unique std name resolves with no import. Sema.w sema_prelude_gate_allows_name says the gate holds "until the fallback tier activates", and this issue has been open three months. The compiler prints the exact use line it refuses to take: the definition of "the program has already determined it". Same for print_i32/print_i64 and every non-prelude std name. Activate the tier (the spec's ambiguity rule: two std candidates for one name is a hard error with each use as a fix-it; one candidate resolves).

  6. added
    ceremony
    high-priority
    on Nov 2, 2026
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

    ceremonyhigh-priorityreproduced

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions