DIP1000: Scoped Pointers (Discussion)

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 12 14:03:20 PDT 2016


On 12.08.2016 22:22, Walter Bright wrote:
> On 8/12/2016 12:34 PM, Timon Gehr wrote:
>> This proposes to add a kind of information the type system is supposed
>> to track
>> (lifetimes), which cannot be communicated losslessly across function and
>> aggregate boundaries. Hence it won't work well in its current form.
>
> I believe it does track across function boundaries, because function
> parameters can be annotated.
> ...

Yes, to some extent, but what the type system knows and makes use of at 
the call site is more informative than what can be tracked around 
function boundaries. The effect is that there are pieces of code that 
cannot be abstracted into their own functions, which creates friction.

> Aggregate boundaries, no, because annotating fields with 'scope' is not
> allowed, like 'ref' fields are not allowed.

This rules out structs that wrap data and adapt it in some interesting 
way, a very common idiom in (generic) D code.


More information about the Digitalmars-d mailing list