Is there any writeln like functions without GC?

Ferhat Kurtulmuş aferust at gmail.com
Thu Oct 31 15:11:42 UTC 2019


On Thursday, 31 October 2019 at 13:46:07 UTC, Adam D. Ruppe wrote:
> On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote:
>> Hi:
>>    why writeln need GC?
>
> It almost never does, it just keeps the option open in case
>
> * it needs to throw an exception (like if stdout is closed)
>
> * you pass it a custom type with toString that uses GC
>
> @nogc is just super strict and doesn't even allow for rare 
> cases.

It would be nice if one reimplement writeln of Phobos by 
bypassing gc and use a custom nogc exception as described here*? 
Of course I can imagine that it would be a breaking change in the 
language and requires so much work for it to be compatible with 
other std modules/language features.

*: 
https://www.auburnsounds.com/blog/2016-11-10_Running-D-without-its-runtime.html


More information about the Digitalmars-d-learn mailing list