[Issue 17953] New: inout-like mechanism to infer function attributes from callback attributes

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 31 00:18:56 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=17953

          Issue ID: 17953
           Summary: inout-like mechanism to infer function attributes from
                    callback attributes
           Product: D
           Version: D2
          Hardware: Other
                OS: Other
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: code at dawg.eu

Not being able to correctly attribute methods is a common issue when designing
interfaces and classes. While it's often still possible to restrict all derived
classes to certain attributes, it's a lot harder to restrict all possible
callbacks.

  void toString(scope void delegate(in char[]) @wildcard) @(wildcard nogc
safe);

It would be a great help if such a method could be defined, to that @nogc,
@safe, pure, and nothrow can be made dependent on the passed in callback,
making it possible to call the method in @nogc code, while also passing in a GC
using callback.

--


More information about the Digitalmars-d-bugs mailing list