[Issue 15732] New: std.function partial does not work with function / delegate references

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Feb 27 06:01:50 PST 2016


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

          Issue ID: 15732
           Summary: std.function partial does not work with function /
                    delegate references
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: abc.mikey at googlemail.com

Created attachment 1587
  --> https://issues.dlang.org/attachment.cgi?id=1587&action=edit
Example of error using partial with delegate reference

Trying to use "partial" from "std.function" with a variable referring to a
function or delegate does not behave as expected. See "example_error.d" for
unexpected behaviour.

ketmar, on #d observed that the issue is either with DMD or with phobos:

   either `is(typeof(basic) == function)` should be true there (and then it's
dmdfe bug), or `partial` should use `isCallable` (and then it's phobos bug)

He was able to provide a fix with the following:

   i changed `static if (is(typeof(fun) == delegate) || is(typeof(fun) ==
function))` line in `partial` to `static if (isCallable!fun)`

Which I will attach as an example.

--


More information about the Digitalmars-d-bugs mailing list