www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15732] New: std.function partial does not work with function


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

Feb 27 2016