[First Draft] Add @gc as a Function Attribute

jmh530 john.michael.hall at gmail.com
Mon Jun 17 13:36:25 UTC 2024


On Monday, 17 June 2024 at 13:10:16 UTC, Dom DiSc wrote:
> On Monday, 17 June 2024 at 13:02:12 UTC, jmh530 wrote:
>> If @gc means not @nogc, then how can the compiler verify that 
>> it can be called from a @nogc block?
>
> A block is nothing. A block cannot call anything, it's just a 
> kind of namespace, meaning the same as declaring every function 
> within it as "@nogc".
> Of course @nogc functions _cannot_ call a function marked as 
> @gc.

My point is that the current behavior is that you know that every 
function within `@nogc {}` does not allocate with the GC. Under 
this DIP, that's no longer guaranteed. So fine, it's not an 
"escape-hatch" per se, but it means that when you see `@nogc {}` 
or `@nogc:` it won't mean what it meant before.

At the very least, if I can misunderstand it, then others could 
too.


More information about the dip.development mailing list