Questions tagged [method-signature]

In computer programming, especially object-oriented programming, a method is commonly identified by its unique method signature, which usually includes the method name, and the number, types and order of its parameters. A method signature is the smallest type of a method.

1
vote
1answer
25 views

Error: Cannot invoke an expression whose type lacks a call signature. (BehaviorSubject)

I can supply a dummy application that demonstrates this, but it boils down to the following: Service file: dialog.service.ts import { Injectable } from '@angular/core'; import { BehaviorSubject } ...
0
votes
0answers
33 views

How to get the kind of parameter from ParameterInfo?

First, to highlight the possibility of an XY problem, I'll point out that my primary goal is to determine if an IInvocation contains a certain Attribute. To do that, I need to get the MethodInfo of ...
0
votes
3answers
39 views

How to define a method with Integer parameter (path placeholding)?

Preface I'd like to saying two things: I don't know how to phrase this question in a few words. So I can't find what I'm looking for when searching (on stackoverflow). Essentially, I apologize if ...
1
vote
1answer
57 views

How to handle changing method signature in java [closed]

I'm writing a Library which has a method M() taking 3 parameters and method signature be like M(param 1, param 2, param 3) which might change during the development cycle. since this library will be ...
1
vote
1answer
47 views

Roslyn: Get formatted method signature/declaration

I have MethodDeclarationSyntax or IMethodSymbol, but I could not find any way, how to access formatted method name: namespace XXX.YYY.ZZZ { public class MyClass { public void ...
2
votes
1answer
53 views

Verify method signatures before swizzling

I have been using method swizzling to swap implementations for unit testing. However, I am concerned that if the production code's method signatures change due to parameter changes, the unit tests ...
0
votes
0answers
12 views

Late Binding Event Handler & Event Signature With Object Type Only Known To Late Bound Assembly

This is a weird one. I haven't found anyone else doing this, and there is probably a reason for that. I am trying to do some late binding by dynamically loading a dll file, and then create objects ...
0
votes
1answer
42 views

Function not matching parameters in language version migration, and how to know the signature of a function

I'm migrating some code I have from an old version of Julia to Julia 1.0.0. Although I already adapted the basic (type -> mutable struct, immutable -> struct), I'm getting the error ERROR: LoadError:...
0
votes
0answers
37 views

Refactoring to Avoid Type Assertion

What's the "correct" way to handle missing type signatures in Typescript for runtime created functions? soap.createClient(wsdlUrl, (_err, client): void => { const GetResources = client....
0
votes
2answers
102 views

Python 3.6 inspect.signature() doesn't show arguments

I have a function: def report(start=1, quantity=100, days_left=7, min_app_version=None): I want to get argument names and default values, something like {'start':1, 'quantity':100, 'days_left':7, '...
0
votes
1answer
54 views

{CallerMemberName} like Functionality for nameof() param

I'm writing more library code and came across an annoyance - here is an example public static TParam RequiredParam<TParam>(TParam param, string name) where TParam : class { return param ?? ...
1
vote
1answer
164 views

How can I work around the new Dart changes which prohibit implementing the same interface with different generics?

My code is rather convoluted out of necessity. I have attempted to simplify the overall layout of the object system I'm working on in order to (hopefully) make it more understandable. abstract class ...
1
vote
0answers
160 views

Is it possible create a custom method attribute to control the method signature or the method's parameters?

I would like to control in a class the signature of certain methods so that it throws a compilation error if a method does not have the signature I want. I have thought do it creating a custom ...
1
vote
1answer
36 views

How can I overload a function with a callable object as a parameter based on the object's call signature?

For example, given the following code class A { public: double operator()(double foo) { return foo; } }; class B { public: double operator()(double foo, int bar) { ...
1
vote
3answers
32 views

Various params method signature versus one object param method signature

I need to construct objects with many properties. I could create one constructor with one param for each property: class Friend{ constructor(name, birthday, phone, address, job, favouriteGame, ...
1
vote
0answers
18 views

Is it possible to deduce the signature of the resolved method/function overload even in case of implicit parameters conversions?

Say we have struct Test { void foo(int *); void foo(float); } test; Given the the following method call: test.foo(1); The compiler will resolve it by invoking Test::foo(float), doing the ...
1
vote
1answer
260 views

get signature of NumPy array object

I'm implementing contextual help in an editor for python that I'm creating. I want to get the methods of classes and those methods' arguments, but I also want the methods of objects. For a NumPy ...
0
votes
1answer
69 views

How do I pass a 3dMax mesh from a maxscript funtion a C# function?

I have a mesh that's created in a maxscript script. And I want to pass it to my C# code, I just can't get the right function signature apparently... It works with a void function (code is called, I ...
0
votes
1answer
122 views

How to change method signature with custom annotation

So long story short I want @Version(1) public Boolean isAlive() { return true; } @Version(2) public Boolean isAlive() { return false; } To Compile. Then use AOP to map the flow to the ...
1
vote
1answer
89 views

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 ...
3
votes
2answers
238 views

Add multiple key values in context.Context from web services API

I have a web application written in Go with multiple modules, one deals with all database related things, one deals with reports, one consists all web services, one for just business logic and data ...
3
votes
0answers
302 views

Reading app signatures from getPackageInfo: The app signatures could be exploited if not validated properly

I am checking and comparing app signature in splash screen for avoid hacking application as much as possible. I have implemented code in splash like below Signature[] sigs = getPackageManager()....
1
vote
1answer
184 views

What are the possible operators for traits in a where clause in Rust?

I'm learning Rust and got to the chapter on trait bounds. In that chapter, they give an example with the + (plus) operator to enumerate all required traits in a where clause. What other operators are ...
-1
votes
2answers
41 views

c# Monitor changes in critical method signatures during build

I stumbled into a cooperation project, where the other part references an interface library of mine and deploys a self compiled MEF Plugin for our tool. I know which methods those guys are using and I ...
5
votes
2answers
69 views

What is in and out on delegate in c#?

In c# code, i found this implement. I tried to find out what this in and out meaning, but only explanation of out keyword in there. So what these in and out keyword do? public delegate Tb Reader&...
4
votes
2answers
85 views

How can you use the 'this' keyword inside of a function signature to set a default parameter?

I have a function that is bound to a React component: functionName(param1, param2 = this.state.field) { } I've never heard of the 'this' keyword being used within a function signature in ...
1
vote
1answer
155 views

Method with different signature but derived from each other

I have a very interesting question and didn't find any answer yet. Hope, someone can help me. First I have a class hierarchy like interface IA {} class A : IA {} class B : A {} Next I have a class ...
3
votes
1answer
319 views

Method signature arguments of type(self) [duplicate]

When I define a class, how can I include arguments in its methods' signatures which have to be of the same class? I am building a graph structure which should work like this, but here is a simplified ...
0
votes
1answer
969 views

Override method in child class using less arguments than base class - Python 3

I am building my first app (Weather report) and I am using tkinter and Python 3.6 for that. I am new to Python so I want to make sure I don't learn bad habits which later on will have to be unlearned :...
0
votes
0answers
15 views

Trouble with argument signatures when passing functions as arguments in Swift [duplicate]

I’m experimenting with passing functions as arguments, and am having trouble getting Swift to accept functions of a particular argument signature. I’ve created a kind of “container” class for method ...
3
votes
2answers
369 views

ObjC method type encoding string for a method with a Block parameter

I'm reading Apple's article about Objective-C runtime type encoding strings but I do not understand how to encode a method with a Block parameter. For example, I have this : - (void)...
0
votes
2answers
334 views

Vue: Event Methods- Confusion

I have a parent Vue which enables or disables "edit" mode. In non-edit mode all components are read only. I've implemented this via a data object and all works fine. I've split out some of the ...
1
vote
4answers
193 views

First argument label in Swift method

Which one of these methods follows the Swift ideology? func addChapter(_ chapter: Chapter) func add(chapter chapter: Chapter) func add(_ chapter: Chapter)
1
vote
1answer
79 views

Inconsistency in number of parameters in base and child methods signatures

I have a Base class with certain method and w/o any parameters: class Base(): def pretty_method(self): print('Hi!') And there are several subclasses and they need additional proceeding ...
3
votes
1answer
117 views

Java method signature compatibility

I have this sample code showing different method signatures: public class Main { public static interface MyMap extends Map {} public void func1(List<MyMap> m) {} public void func2(...
0
votes
1answer
1k views

Ambiguous action methods with different HttpMethod

I'm experiencing a weird behaviour, at least to me. I written two methods within a controller with apparently different signatures: [Route("~/Wallets/{walletId}/Transactions/Add")] public async Task&...
2
votes
3answers
81 views

Javascript same method signature

Can someone please explain why we can simply pass a method name to a higher order function and everything works just fine. I know in something like Java I have to call the method words on each element ...
1
vote
3answers
1k views

Best Way to Set Day to the First of the Month Using DateTime Without Inherent WithDayOfMonth Method

So, I'm trying to basically take 2 DateTime objects and set them to the first day of their respective months so that I can ultimately calculate the months between the two dates. Example of the code: ...
1
vote
1answer
221 views

Function signature and inheritance in C++

Assume I have two classes A and B and B derives A. Class A: class A { public: virtual const unsigned char* getArray() { return array; } protected: unsigned char array[250]; }...
3
votes
2answers
399 views

Method signatures, overloading, overriding: are all these terms related?

The terms "overloading" and "overriding" sound very similar (that is why they are opposed sometimes to each other), but are these two notions technically related? Are the terms "overloading" and "...
0
votes
2answers
127 views

“_” character in Swift functions/methods [duplicate]

I'm reading some chapters of the Apple's Swift Programming Language and I find that methods and functions signatures in the reference have an _ character as argument(s), for instance the print ...
2
votes
2answers
212 views

Groovy best/recommended approach to ensure correct argument type

I'm trying to do things in the best "Groovy-way" possible. What's the best way to check the type of an argument (regarding performance and the "Groovy-way)? I have 2 implementations in mind: def ...
3
votes
2answers
1k views

IntelliJ: Search for Checked exceptions, declared in method signature, but never thrown in body [closed]

I've got a rather simple IntelliJ/tool question here: I'm currently dealing with some legacy code and started to rework stuff here and there. What I stumbled upon very often are declared (checked) ...
0
votes
1answer
63 views

virtual table with different parameter types

class Base { public: virtual void f(float) { cout << "Base::f(float)\n"; } }; class Derived : public Base { public: virtual void f(int) { cout << "Derived::f(int)\n"; } }; ...
1
vote
2answers
186 views

Refactor method header parameter order

I fighting with a refactoring issue in my Eclipse IDE. I have this interface method: List<String> evaluateAllPoi(boolean pIsVerified, List<String> pAllNames, List<String> ...
4
votes
1answer
2k views

How to specify any newable type in TypeScript?

I tried with this but it doesn't work. Foo is just a test of what works. Bar is the real try, it should receive any newable type but subclasses of Object isn't valid for that purpose. class A { } ...
6
votes
2answers
4k views

Why is throws part of the method signature

Why is throws on a method part of it's signature. It seems strange to include it. Here is a example where it is in the way. @Overide public void foo() { throw new UnsupportedOperationException(); ...
-2
votes
1answer
35 views

Why Are There Three Words In Some Protocol Init Signatures [duplicate]

When I write a new method signature in Swift, I follow the pattern: func methodName(varName1: VarType1, varName2: VarType2, ...) { Looking at some of the required protocol initializers, I have found ...
0
votes
1answer
86 views

Generic methods with duplicate signature [duplicate]

I have these two method-signatures: protected object HandleRequest<TResponse, TRequest>(Func<TRequest, TResponse> func, TRequest request) where TResponse : BaseResponse where ...
-1
votes
1answer
28 views

Is there a standard function signature for the digital signature “verify” function?

Is one of these (or something else) more standard than the alternatives? verify(message, signature, publicKey) vs verify(signature, message, publicKey)

http://mssss.yulina-kosm.ru