www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17953] New: inout-like mechanism to infer function attributes

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 puremagic.com
          Reporter: code 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.

--
Oct 30 2017