DIP69 - Implement scope for escape proof references

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 17 05:48:23 PST 2014


On Wednesday, 17 December 2014 at 12:29:21 UTC, Ola Fosheim 
Grøstad wrote:
> On Wednesday, 17 December 2014 at 11:13:02 UTC, Marc Schütz 
> wrote:
>> On Wednesday, 17 December 2014 at 07:48:52 UTC, bearophile 
>> wrote:
>>> Walter Bright:
>>>
>>>> I'm afraid I don't understand at all what you wrote.
>>>
>>> Perhaps reading about linear type systems could help:
>>>
>>> http://en.wikipedia.org/w/index.php?title=Substructural_type_system&redirect=no#Linear_type_systems
>>
>> But note that we want a "relaxed" linear type system. In 
>> general, we are fine with multiple aliases, although there are
>
> Pointer aliasing is an optimization killer, which is why C99 
> added the «restrict» keyword. I think in most cases the use of 
> stack allocated objects tend to be alias-free, so it is 
> important that this knowledge is retained so that the compiler 
> can make use of it.
>
> http://en.wikipedia.org/wiki/Pointer_aliasing

If you have owner ship, you have free. If you have a pair 
alloc/free then you can promote on stack.

This is a much more powerful way to handle things, as this take 
advantage of inlining.


More information about the Digitalmars-d mailing list