Questions tagged [function-signature]

80 questions
1
vote
1 answer

What does "requires" mean in F# function signature?

Please explain the following function signature which appeared when I hovered over the function in VS Code. I'm especially curious what exactly "requires" means and why 'b is 'a. val handleSingleEvent: : Request -> 'b (requires :>…
LearnerX
  • 137
  • 2
  • 8
1
vote
1 answer

Function Signatures/Interfaces from Pybind11 Module (IDE Suggestions)

Let's assume we have a simple module called _sample built with pybind11: /* py_bindings.cpp */ #include namespace py = pybind11; PYBIND11_MODULE(_sample, m) { m.def("add", [](int a, int b) { return a + b; }); …
Phil-ZXX
  • 2,359
  • 2
  • 28
  • 40
1
vote
1 answer

Apache Drill UDF: No match found for function signature

Hi I'm developing drill user-defined functions. I have written this UDF. package somepackage.udfs; import io.netty.buffer.DrillBuf; import org.apache.drill.exec.expr.DrillSimpleFunc; import…
1
vote
1 answer

When I decorate a python function, VS Code shows the wrapper's help, instead of the function's , when hovered

VS is code is now the most popular code editor and I love it. When you hover your mouse over a function, it shows you the function signature and help doc string. When you decorate a function, its help docstring changes to that of the wrapper's. ( to…
1
vote
2 answers

C++ more than one instance of overloaded function matches the argument list when creating a header file

Within my main file of my program I have the following declarations int main() { Customer c; Part p; Builder b; auto partsVec = readpartFile(); auto customerVec = readcustomerFile(); auto builderVec = readbuilderFile(); …
1
vote
3 answers

Variable variables as parameters of custom function in usort()

I've been playing around and seeing if I can set up a more dynamic method in PHP. usort( $dataset, function($a, $b){ return strcasecmp($a[$this->parameters], $b[$this->parameters]); } ); This line would sort array elements in…
1
vote
2 answers

PyCharm: is this kind of automatic signature refactoring possible?

A Python code of a project has a lot of function definitions and calls like: def some_function(a, b="", c=0, d=None, e="something"): # whatever pass some_function("a", "b", 1, e="something else") This is very hairy (bad practice - missing…
1
vote
1 answer

PHP type hinting is being ignored, no TypeError exception is thrown

I just debugged some PHP 7.1 code where I'd forgotten to remove a (bool) cast on the return value, but the function had a declared return type of int: function get_foo(): int { $val = get_option('foo'); return (bool) $val; } $foo =…
Luke Sawczak
  • 313
  • 4
  • 14
1
vote
1 answer

In Haskell, can you have a signature of a function that calls other functions but doesn't have an implementation?

So I'm learning Haskell and I have to implement a treeunzip function that takes a tree of the type (Tree (a,b)) where 'a' and 'b' are integers and returns a list of the two trees unzipped, that is (Tree a, Tree b). I can get one of the two trees but…
BourbonCreams
  • 353
  • 4
  • 21
1
vote
1 answer

c++ regex for fetching function signature

I am trying to search a function signature using regex_search in c++. Here's what I am using std::smatch m; std::regex…
pgundlupet
  • 41
  • 5
1
vote
2 answers

Check if class object is defined in extension module

Given a class object in Python, how can I determine if the class was defined in an extension module (e.g. c, c++, cython), as opposed to being defined in standard python? inspect.isbuiltin returns True for functions defined in an extension module,…
1
vote
1 answer

Difference between "function($arg = 0)" and "function($arg)"

Question In the PHP Official Documentation I found somewhere declarations like this: public int save ( string $filename [, int $options ] ) and like this: public mixed load ( string $filename [, int $options = 0 ] ) What's the difference between…
Kamafeather
  • 8,663
  • 14
  • 69
  • 99
1
vote
2 answers

Why can't the compiler deduce to this function template?

We have a function that takes a function object as parameter. There are two overloads of the function, which differ in the function signature. #include template void foo(std::function bar) { } template
danijar
  • 32,406
  • 45
  • 166
  • 297
1
vote
4 answers

Excel Function format

I am quite new to writing functions in excel (been mainly coding sub procedures). I was wondering what the following function declaration means? public function function_name(args as string) as string I understand everything up to the second…
SeekingAlpha
  • 7,489
  • 12
  • 35
  • 44
1
vote
2 answers

why name mangling isn't breaking my program?

Possible Duplicate: Is main() overloaded in C++? here's my code: #include int main(void* a, void* b) { std::cout << "hello standalone " << std::endl; return 0; } different parameters should have a…
new_perl
  • 7,345
  • 11
  • 42
  • 72