[Dlang-internal] DIP1000 discussion and testing

Walter Bright via Dlang-internal dlang-internal at puremagic.com
Sat Dec 17 21:56:42 PST 2016


On 12/17/2016 7:56 PM, Martin Nowak wrote:
>> On 12/17/2016 7:38 AM, Mathias Lang wrote:
>>> For example, a stack allocator will return data that is already typed as
>>> `scope`, and as a consequence, interior pointers will not be expressible. I'll
>>> see if I can form an example in terms of code.
>>
>> It should work fine.
>
> What does "it" refer to here, doesn't hurt much to write "Internal pointers in
> scope structs" or so.
> Equally "work fine" doesn't state how the "it" is supposed to work.

A stack allocator is conceptually returning a slice of a static array allocated 
on the stack. This works with scope.

Understanding scope always goes back to understanding how it works with pointers 
and addresses. Adding layers of abstraction over that can be confusing by 
obfuscating that relationship, but rewrite the abstract as pointers and 
addresses, and the behavior then becomes clear.

The bugs Mathias has posted have (so far) all been the result of an abstraction 
not conforming to how pointers and addresses work, due to a bug in dmd.


>>> And since I started toying around with aggregate methods, here's another reason
>>> why changing the STC of a field member is a very bad idea:
>>
>> It doesn't change the STC of field members. Only of locals.
>
> What's it here? Your DIP or the dmd implementation?

The dmd implementation.


More information about the Dlang-internal mailing list