On Sunday, 23 August 2020 at 19:39:35 UTC, Paul Backus wrote:
https://pbackus.github.io/blog/how-does-memory-safety-work-in-d.html

What exactly do we mean when we talk about "memory safety" in D? Is it the same thing as "undefined behavior"? Is it ever correct to mark and `extern(C)` function as `@trusted`? This post is my attempt to understand, and answer, questions like these.

If you think I've gotten anything wrong, please leave a reply--this is definitely an area where I'm still learning.

Good post.

I think there is a workaround to the variable access being always safe. Something like this in a dedicated module:

```
struct SystemVar(T, bool safeVal)
{  private T _var;
   static if (safeVal) @safe pure nothrow @nogc auto val()
   {  return _var;
   }
   else pure nothrow @nogc auto val(){return _var;}
   pure nothrow @nogc ref var(){return _var;}
}
```

Reply via email to