Warn about using the GC

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Sun Jan 14 13:55:50 UTC 2024


On Sunday, 14 January 2024 at 13:40:11 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> Earlier on I considered ``@assumenogc`` instead.
>
> It could work, but is much more explicit in code, that probably 
> doesn't care. Which is why this should be the default, not 
> opt-in.

I'd prefer it to be used explicitly as with `@trusted` since you 
should think twice before using gc, where people intend nogc. It 
may work as you've stated only when lib dev allows it to, i.e. 
only when callback parameter was declared with `@assumegc`.

That would allow it to be spotted easier, and allow reviewers to 
fuss over if they prefer to.

Besides now you need to put `@nogc` on callback anyways, so 
changing it to `@assumegc`, would be same level of pain.


More information about the Digitalmars-d mailing list