[First Draft] Add @gc as a Function Attribute

Quirin Schroll qs.il.paperinik at gmail.com
Mon Jun 17 11:37:22 UTC 2024


On Friday, 14 June 2024 at 19:19:15 UTC, jmh530 wrote:
> On Friday, 14 June 2024 at 16:20:02 UTC, Quirin Schroll wrote:
>> Permalink: 
>> https://github.com/Bolpat/DIPs/blob/8a26c2545b0a6926d799e9d8dc8c3662e58d516b/DIPs/DIP-4NNN-QFS.md
>>
>> ---
>>
>> **Abstract:** Add `@gc` as a new function attribute that acts 
>> as the inverse of the `@nogc` attribute.
>
> The DIP makes it seem like it is an escape-hatch for @nogc. But 
> then @nogc would no longer be providing any guarantees.

You didn’t understand the DIP. It’s not an escape hatch. `@gc` is 
just an explicit form of the default behavior allowing GC 
allocations. You can’t call a `@gc` function from a `@nogc` 
function, the same as you can’t call a `@system` function from a 
`@safe` function.


More information about the dip.development mailing list