DIP1000: Memory Safety in a Modern System Programming Language Pt.1

Steven Schveighoffer schveiguy at gmail.com
Wed Jun 22 20:48:13 UTC 2022


On 6/21/22 11:05 AM, Mike Parker wrote:
> Ate Eskola was inspired to write a series of tutorials about DIP1000 for 
> the D Blog. The first post in the series is live. If you haven't yet dug 
> into DIP1000 much or understood how to use it, this should give you 
> enough to get started.
> 
> The blog:
> https://dlang.org/blog/2022/06/21/dip1000-memory-safety-in-a-modern-system-programming-language-pt-1/ 
> 
> 
> Reddit:
> https://www.reddit.com/r/programming/comments/vhfd28/memory_safety_in_a_modern_system_programming/ 
> 

Dip1000's point is starting to seep in. I still think it's going to be a 
challenge for people new to D (not just us old-timers). But...

The part about `scope` being shallow. This is a problem.

```d
scope a = "first";
scope b = "second";
string[] arr = [a, b]; // invalid regardless of attributes in @safe code
```

Sometimes algorithms require manipulation of structure, such as sorting 
arrays, or using linked lists, and sometimes it's nice to be able to 
point at things on the stack, temporarily. This is one of the things I 
was looking forward to with dip1000, since it does allow pointing at the 
stack when it can work out the details.

Is there any plan to address this other than "just use `@system`"?

-Steve


More information about the Digitalmars-d-announce mailing list