pragma(explicit_gc)
Timon Gehr
timon.gehr at gmx.ch
Thu May 2 01:59:28 UTC 2024
On 5/2/24 03:52, Richard (Rikki) Andrew Cattermole wrote:
> On 02/05/2024 1:45 PM, Timon Gehr wrote:
>> Proposal: Add `pragma(explicit_gc)`. Functions marked with this pragma
>> will non-transitively error out on implicit GC allocations. This is a
>> useful tool to check expectations about escape analysis precision.
>
> I have been proposing this for years under the name ``@localnogc``.
> ...
I see. I do think that making it a `pragma` may be more fruitful,
because a function attribute would typically be part of the type of a
function. However, the interface of the function is not actually
affected by such checks.
> Although I would disallow new'ing an exception with it annotated.
> ...
I guess this check could be bypassed using a nested function if needed,
but I think explicit allocations are simply not an issue as they do not
defy expectations.
> At some point I want to do an attribute cleanup DIP.
>
> Make all attributes positive, include negation form, introduce the
> throws set and of course ``@localnogc`` and ``@notls``.
Sounds good.
More information about the dip.ideas
mailing list