On Tuesday, 20 June 2017 at 09:56:03 UTC, Bastiaan Veelo wrote:
Transferring this to GC, you could have @gc (the default),
@nogc (the @safe equivalent) and the @trusted equivalent:
@gc_code_that_is_acceptable_to_be_called_in_nogc_code_as_an_exception_to_the_rule. I'll abbreviate this as @gc78 until there is a better name.
It can already be done:
void gc78writeln(string what) @nogc
{ import std.stdio;
alias WritelnType = void function(string) @nogc;
(cast(WritelnType)&writeln!string)(what);
}
void main() @nogc
{ import std.stdio;
gc78writeln("hello world!");
}
I wasn't skilled enough to make a generic version of this trough.
And I do not know what happens if @nogc function ends up calling
gc.