DIP1000 observation

Paul Backus snarwin at gmail.com
Mon Sep 2 13:44:51 UTC 2024


On Monday, 2 September 2024 at 13:15:51 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> The core issue with using DIP1000 is that it is not trying to 
> solve escape analysis or owner escape analysis for heap memory. 
> It is being misused to try to model heap memory. I do not 
> believe that it is fixable, it's simply solving a problem in a 
> way that directly negatively affects most code, and it does so 
> by not respecting the problem domain or the literature on the 
> topic.

As someone who has written a bunch of code using DIP 1000 to try 
and model ownership of heap memory, I can confirm that this is 
100% correct. The way it's done is by essentially lying to the 
compiler, and telling it to treat a pointer to the heap *as 
though* it's a pointer to the stack.

It's kind of like template metaprogramming in C++. It's a clever 
hack, and the fact that it works at all is kind of impressive. 
But we shouldn't *have* to resort to clever hacks like this to 
solve simple problems.


More information about the Digitalmars-d mailing list