io/print_str appends an implicit newline (de facto println) #29
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The effect operation
io/print_stris namedprint_strbut the runtime codegen lowers it to a C@putscall (crates/ailang-codegen/src/lib.rs around theio/print_strbranch).putswrites the string plus a trailing newline — soio/print_stris in factprintln_str.This is undocumented in the design/ ledger (effects.md, prelude-classes.md, str-abi.md mention the op but not the newline semantics) and surprises LLM authors: in the cross-model-authoring naming-A/B run, every Qwen3-Coder output that wrote explicit
"\\n"after the int_to_str produced doubled newlines and failed the stdout match for t3_main_prints across all three cohorts.Two coherent fixes (pick one — separate spec discussion):
fputs(s, stdout)soio/print_strliterally prints exactly the bytes ofs. The name then matches the behaviour. Authors who want a newline write"\\n"themselves.io/println_str(orio/print_line) and document the auto-newline. Either way: stop calling itprint_strwhile it secretly newlines.Option 1 is semantically cleaner and matches the name; option 2 is the smaller change. The design/contracts/effects.md spec needs to spell out whichever choice is made.