[Dlang-internal] DIP1000 discussion and testing
Martin Nowak via Dlang-internal
dlang-internal at puremagic.com
Tue Oct 25 00:06:45 PDT 2016
On Monday, 24 October 2016 at 09:13:58 UTC, Mathias Lang wrote:
> void* escape3 (scope void* p) @safe
> {
> Escaper e;
> scope dg = () { return e.e; };
> e.e = p;
> return dg();
> }
Seems like this would require that the scope tainting is done in
a separate pass, before going through the statements in lexical
order. The dg needs to know that e will escape in order to change
to return scope.
Not sure the compiler is ready for 2-pass function semantics.
While it's clearly powerful, my intuition also goes a bit against
it.
- Does the compiler architecture allow for the necessary
semantics.
- What's a use-case that requires this?
- Might the scope inference graph have cycles?
- Can humans understand scope inference, and can we print proper
error messages?
It might be a bit too ambituous, and turn out to be an unforced
error creating too many scope holes.
More information about the Dlang-internal
mailing list