Questions tagged [dispatch]

Dynamic dispatch (also known as dynamic binding) is the process of mapping a message to a specific sequence of code (method) at runtime. This is done to support the cases where the appropriate method cannot be determined at compile-time (i.e. statically).

Dynamic dispatch is only used for code invocation and not for other binding processes (such as for global variables) and the name is normally only used to describe a language feature where a runtime decision is required to determine which code to invoke.

This Object-Oriented feature allows substituting a particular implementation using the same interface, and therefore it enables polymorphism.

http://en.wikipedia.org/wiki/Dynamic_dispatch

974 questions
4
votes
2 answers

Confusion about UseMethod search mechanism

I'm trying to figure out how R's UseMethod finds a method once it figures out what its looking for (i.e. function MyGeneric( x ) called with x of class MyClass: MyGeneric.MyClass) Specifically, what environments are involved? I have read section…
Suraj
  • 35,905
  • 47
  • 139
  • 250
3
votes
2 answers

understanding system call dispatcher for windows?

I am trying to do some reversing to find out a function call behind the scene. While debugging using windbg I came across a call, mov edx,offset SharedUserData!SystemCallStub call dword ptr [edx] call leads to code…
RLT
  • 4,219
  • 4
  • 37
  • 91
3
votes
3 answers

Implementing a Dispatch Table in Objective-C: how to declare an array of selectors

I'm trying to implement a dispatch table, so that I can call a selector with the following example code: NSInteger i = 2; [myObject performSelector:selectors[i]]; I'm trying to store user preferences which affect which method of an API gets called.…
Moshe
  • 57,511
  • 78
  • 272
  • 425
3
votes
2 answers

Why do target APIs use Any instead of AnyObject?

Why do Objective-C APIs like NotificationCenter.addObserver or UIButton.addTarget get imported into Swift with a an observer of type Any, instead of AnyObject? Is there any reason for that? Is it even possible to correctly specify selector to…
3
votes
1 answer

In Julia what's the difference between dispatching on abstract types versus parametric subset of abstract types?

Are there functional or performance differences between myfunction(x::Real), and myfunction(x::T) where {T<:Real}? In this case, Real is an abstract type which obviously has concrete subtypes like Float64 and Int. Are there reasons to prefer one…
Alec
  • 4,235
  • 1
  • 34
  • 46
3
votes
2 answers

NgRx how to dispatch 2 actions in order

I cant seem to find a way with the NgRx (not RxJS Style) to dispatch 2 Actions in an effect. I would like to (IN THIS ORDER): delete a Movie in the Database with an effect, dispatch deleteMovieSuccess dispatch getMovies (I need to reload all Movies…
DigitalJedi
  • 1,577
  • 1
  • 10
  • 29
3
votes
1 answer

vuex module axios in vue3 composition api

I am new to vue and working with vue 3 and the composition API. It is really hard to find stuff related to the composition API, so I try to get help here. I am using axios in combination with vuex modules for consuming APIs. How can I transfere this…
kate9247
  • 33
  • 6
3
votes
1 answer

Redux sending two dispatch after each other then the first dispatch get lost

I learn React Javascript and Redux and now I have this problem. Here's a codesandbox Try like this: Search for book title "dep" Watch the log show "Search url is:", when it should show "Starting books search.." I send two Redux dispatch after each…
Kid
  • 1,869
  • 3
  • 19
  • 48
3
votes
1 answer

What does the type graph look like in Julia?

I just started looking a Julia. I'm interested in how it accomplishes multiple dispatch, specifically how it determines the type for use in multiple dispatch. In the introduction to Types,the manual states: all values in Julia are true objects…
Ana Nimbus
  • 635
  • 3
  • 16
3
votes
3 answers

How to manipulate a global state outside of a React component using Recoil?

I'm using Recoil, and I'd like to access the store outside a component (get/set), from within a utility function. More generally, how do people write re-usable functions that manipulate a global state with Recoil? Using Redux, we can dispatch events…
Vadorequest
  • 16,593
  • 24
  • 118
  • 215
3
votes
1 answer

Context - dispatch is not a function (React)

Very new to context and reducers in React. I am currently trying to use Context to get a date string from an event on a Line Graph. The line graph I'm using is from react-chartjs-2. My context is setup and provided as below: export const Context =…
Malkeir
  • 113
  • 7
3
votes
2 answers

Determine the type of a return value from dispatch

I'm coding a functional component in redux and I added a return values for a specific action. The new value comes from a Promise so if the type is called Ival the return value will be of type Promise (null in case the response…
Gabriel
  • 121
  • 1
  • 1
  • 8
3
votes
1 answer

java event queue event dispatch flush/trap events

I have a design related question that I am trying to find an answer to. Here is the scenario. Suppose that you want to do something expensive (time-consuming) as a result of user input (e.g. loading huge amounts data from some database, reading…
Santosh Tiwari
  • 1,167
  • 2
  • 14
  • 26
3
votes
1 answer

Compiling same class defined in header in cpp files compiled against multiple architectures

Let's say I've defined a class like so: #include enum class cpu { sse2, sse4, avx, avx4 }; template class foo // current_cpu defined based on compiler's target architecture { std::vector
keith
  • 5,122
  • 3
  • 21
  • 50
3
votes
3 answers

Branch on null vs null object performance

Which is most efficient: using a null object, or a branch on nullptr. Example in C++: void (*callback)() = [](){}; // Could be a class member void doDoStuff() { // Some code callback(); // Always OK. Defaults to nop // More code …
user877329
  • 6,717
  • 8
  • 46
  • 88