Issue 20663 - writeln should be @nogc
Summary: writeln should be @nogc
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-10 17:23 UTC by Manu
Modified: 2024-12-01 16:36 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Manu 2020-03-10 17:23:28 UTC
I have had multiple complain (one of them *phoned me from overseas*) that writeln() doesn't work in @nogc.

Their claim goes: "How can it be acceptable that writeln() doesn't work in @nogc? It's literally the first thing you try and do!"

I have to agree. writeln() really should work everywhere, always.
Comment 1 Adam D. Ruppe 2020-03-10 17:44:15 UTC
Whatever happened to that dip 1008 thing?

Or perhaps we could just change the invalid utf 8 sequence exception to the replacement char. I'd personally argue that is more useful for writing anyway (I often cast stuff to byte for it)
Comment 2 Manu 2020-03-10 19:23:21 UTC
Dunno what's going on with DIP1008, but I actually agree that using the replacement char is actually the more interesting and useful thing to do.

I might be interested in throwing a UTF exception from a function like `validateString`, but I don't want writeln to throw! I want it to write text to the output stream... it has one job!
Comment 3 Adam D. Ruppe 2020-03-10 19:36:32 UTC
hmmm took a look at the code and the other thing that throws is on fwrite errors. I forgot about those... could possibly throw a static instance or something but that complicates the easy idea of just using replacement char.
Comment 4 dlangBugzillaToGithub 2024-12-01 16:36:30 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/9790

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB