[Dlang-internal] DIP1000 discussion and testing

Dicebot via Dlang-internal dlang-internal at puremagic.com
Mon Oct 24 02:30:49 PDT 2016


On 10/24/2016 12:13 PM, Mathias Lang wrote:
> Crafting a test case that exploit this was trivial:
> void* escape3 (scope void* p) @safe
> {
>     Escaper e;
>     scope dg = () { return e.e; };
>     e.e = p;
>     return dg();
> }

I think it is quite possible to keep non-transitive semantics to enable
designing correct @trusted wrappers, the problem comes from trying to
magically work as valid @safe code.

Really, all we need is for developer to be able to say that some
pointer/reference may only be used as long as host aggregate exists.
With that transitivity can be emulated by removing direct access to
reference-type fields and marking matching getters as scope.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/dlang-internal/attachments/20161024/2da1d9dd/attachment.sig>


More information about the Dlang-internal mailing list