digitalmars.D.bugs - [Issue 16551] New: Compile-time delegate parameters should allow
- via Digitalmars-d-bugs (29/29) Sep 27 2016 https://issues.dlang.org/show_bug.cgi?id=16551
https://issues.dlang.org/show_bug.cgi?id=16551 Issue ID: 16551 Summary: Compile-time delegate parameters should allow "scope" Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: eyal weka.io Currently, in order to pass scoped delegates and avoid GC, one must pass the delegates as run-time parameters, with undesirable consequences. It would be very helpful to allow them to be passed as scoped and in compile-time. alias Foo1 = void delegate() nogc; alias Foo2 = scope void delegate() nogc; // <-- this "scope" seems to be completely ignored! // Syntax error, why? :( // void foo(scope Foo1 x)() nogc; // This is allowed, but Foo2 is not truly "scope" void foo(Foo2 x)() nogc; void main() nogc { int x; foo!({x+=1;}); // Claims to allocate with the gc, it does not! } --
Sep 27 2016