Cool pattern or tragic?

cc cc at nevernet.com
Mon Sep 25 00:07:03 UTC 2023


On Friday, 25 August 2023 at 21:00:08 UTC, Guillaume Piolat wrote:
> The idea is to deliberately mark @system functions that need 
> special scrutiny to use, regardless of their memory-safety. 
> Function that would typically be named `assumeXXX`.
> ...
> That way, @safe code will still need to manually @trust them.

I basically wanted some kind of functionality similar to this but 
with regards to the GC.  Like some way to annotate a function as 
@WillAllocate or something, and forbid calling it unless the 
caller function explicitly acknowledged the allocation (without 
having to wrap everything in @nogc).  Just for fun I experimented 
with a locking GC that used the struct/dtor model to open/re-lock.



More information about the Digitalmars-d-learn mailing list