DMD 2.100, bring ont he attribute soup

Paul Backus snarwin at gmail.com
Fri May 27 00:34:41 UTC 2022


On Thursday, 26 May 2022 at 23:25:06 UTC, Walter Bright wrote:
> On 5/26/2022 3:54 PM, deadalnix wrote:
>> The problem with DIP1000, is that it doesn't provide me with 
>> invariant I can rely upon,
>
> It does for stack based allocation.
>
>
>> because it is unable to track more than one level indirection. 
>> It can only detect some violation of the invariant, but not 
>> all (in fact, probably not the majority).
>
> It's designed to track all attempts to escape pointers to the 
> stack, and I mean all as in 100%. It will not allow building 
> multilevel data structures on the stack.

I would say that the biggest issue with DIP 1000 is that it 
spends a significant chunk of D's complexity budget, while 
offering only relatively modest benefits.

On the one hand, DIP 1000's limitations:

* It only works for stack allocation
* It only handles one level of indirection
* It cannot express `return ref` and `return scope` on the same 
parameter (so no small-string optimization, no StackFront 
allocator...)

On the other hand, the investment it demands from potential users:

* Learn the differences between `ref`, `return ref`, `scope`, 
`return scope`, `return ref scope`, and `ref return scope`.
* Learn how the various rules apply in situations where the 
pointers/references are hidden or implicit (e.g., `this` is 
considered a `ref` parameter).
* Learn when `scope` and `return` are inferred and when they are 
not.
* Probably more that I'm forgetting...

Is it any wonder that a lot of D programmers look at the two 
lists above and conclude, "this newfangled DIP 1000 stuff just 
ain't worth it"?



More information about the Digitalmars-d mailing list