function_ptr: handle scope of function pointers better