Skip to content

spec §18.2 / D55: print[T: Display](v: &T), not v: T - #1326

Merged
ehartford merged 1 commit into
mainfrom
spec-print-ref
Sep 22, 2026
Merged

ehartford merged 1 commit into
mainfrom
spec-print-ref

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

One-word correction to ruling 6's spelling (proposed on #1277, implemented in #1325): print[T: Display](v: &T). With v: T the generic consumes its argument — print(s); print(s) on an owned str is a use-after-move and print(GLOBAL) is a move out of a global (D52) — against §3.8 (an observing function takes &T). The &str instance is byte-identical to the previous print; auto-referencing keeps every call free of &. Docs-only, inventory check green; your merge is the blessing.

…kes &T (§3.8); v: T consumed owned strings and refused globals (D52)

Implementing D55 ruling 6 (PR #1325) showed the literal v: T consumes its
argument: print(s); print(s) on an owned str is a use-after-move and
print(GLOBAL) is a move out of a global. §3.8 says an observing function
takes &T; the &str instance is byte-identical to the previous print. One
word, proposed on #1277 and implemented in #1325; Eric's blessing is the
merge.
@ehartford
ehartford merged commit c9379fe into main Sep 22, 2026
@ehartford
ehartford deleted the spec-print-ref branch September 22, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant