Help, what is the code mean?

Adam D. Ruppe destructionator at
Mon Apr 27 16:23:06 UTC 2020

On Monday, 27 April 2020 at 15:24:09 UTC, lilijreey wrote:
> Thanks your help. where is unsafe in above code?

It depends on the context but I assume it is because it is 
storing a reference to the function across thread boundaries, 
something normally banned, but since it is (I believe) a private 
member it is promising the compiler "trust me, I'm doing this 
implementation detail right". Hence the keyword "@trusted".

This is not the way that keyword was originally designed to be 
used, hence the janky syntax, but the stdlib authors use the 
pattern in a few places anyway.

More information about the Digitalmars-d-learn mailing list