DIP77 - Fix unsafe RC pass by 'ref'
via Digitalmars-d
digitalmars-d at puremagic.com
Thu Apr 9 12:46:22 PDT 2015
On Thursday, 9 April 2015 at 18:31:24 UTC, deadalnix wrote:
> On Thursday, 9 April 2015 at 09:05:10 UTC, Ola Fosheim Grøstad
> wrote:
>> 2. How will this work with "yield"?
>>
>
> You yield both caller and callee, so you'll get caller's boxing
> in the yield.
But the coroutine stack and everything on it will be intact when
it yields, including references to array elements...?
>> Why not just implement the more generic solution (shared
>> pointers with move/borrow or WPO) ?
>
> I don't think this is possible.
It should be possible with pointer analysis, but the easier
approach is just to ban non-const ref parameters (c++ style) for
rc-pointer-objects, so maybe D should provide "head const" after
all...
More information about the Digitalmars-d
mailing list