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
10
votes
3 answers

Redux - relation of reducers to actions

I am new to react/redux. I am trying to figure out how all the pieces in redux interact. The one thing giving me trouble is understanding the relation between actions and reducers. When an action is called, how does the store know which reducer to…
steveareeno
  • 1,925
  • 5
  • 39
  • 59
10
votes
2 answers

Is S4 method dispatch slow?

My S4 class has a method that is called many times. I noticed that the execution time is much slower than it would be if a similar function was called independently. So I added a slot with type "function" to my class and used that function instead…
Soldalma
  • 4,636
  • 3
  • 25
  • 38
9
votes
1 answer

What does "dispatch()" mean/do, and why is it used when we have .then() and .catch()

I am new to ES6 and advanced javascript. I have seen examples of code using the axios http client like this: axios.xxx(...).then((res) => dispatch(success(res)) , (err)=> dispatch(error(err))) whereas I am…
yen
  • 1,769
  • 2
  • 15
  • 43
9
votes
1 answer

How to deal with thread and Realm ? (iOS)

I use Realm to store my model objects. In my object I have a function which generate NSData from its own properties values. This generation can be long, So I would like to generate my NSData in a thread with handler block. My problem is that Realm…
user4141198
9
votes
2 answers

How to implement Flask Application Dispatching by Path with WSGI?

I would like to use a single domain as a Staging Environment for multiple flask applications that will eventually run on their own domains. Something…
detachedhead
  • 173
  • 2
  • 8
9
votes
3 answers

How do we dispatch Google Analytics events when iOS app goes to the background?

My iOS app has links to Apple's App Store in it and I am trying to track those as events. The problem is that we can't get my app to properly dispatch the GA events before it goes into the background. We are using iOS SDK v2beta4. Here is an…
9
votes
3 answers

Google Analytics iOS v2beta3 - manual dispatch doesn't work in applicationWillResignActive

I've been working with Google's Analytics SDK v2beta3 and have everything working except I can't get manual dispatch to work when the app leaves the active state. (fyi, for my app I need to reserve battery power so am only using '[[GAI…
Steve Mason
  • 191
  • 3
9
votes
2 answers

Use invokedynamic to implement multiple dispatch

I wondered if Java7's new invokedynamic bytecode instruction could be used to implement multiple dispatch for the Java language. Would the new API under java.lang.invoke be helpful to perform such a thing? The scenario I was thinking about looked as…
Matt
  • 868
  • 8
  • 12
9
votes
4 answers

Dynamic dispatch to derived class in C#

I'm trying to do the following: public abstract BaseClass { public virtual void ReceiveEvent(Event evt) { ProcessEvent(evt as dynamic); } private void ProcessEvent(object evt) { LogManager.Log(@"Received an event…
Jamona Mican
  • 1,574
  • 1
  • 23
  • 54
8
votes
2 answers

How to convert dispatch_data_t to NSData?

Is this the right way? // convert const void *buffer = NULL; size_t size = 0; dispatch_data_t new_data_file = dispatch_data_create_map(data, &buffer, &size); if(new_data_file){ /* to avoid warning really - since dispatch_data_create_map demands we…
hfossli
  • 22,616
  • 10
  • 116
  • 130
8
votes
1 answer

How to test react useContext useReducer dispatch in component

hope someone can point me the right direction with this. Basically I've created a react app which makes use of hooks, specifically useContext, useEffect and useReducer. My problem is that I can't seem to get tests to detect click or dispatch…
Noelt
  • 111
  • 1
  • 5
8
votes
2 answers

Clarification on function signature and dispatching behaviour in julia

I was trying out some things in the Julia (1.2) REPL and I stuck my mind on something I don't understand about dispatching. I first tried this thing which is working the way I expected: f(a::T) where {T <: Int} = "Test" Calling f(3) works since…
SnoopyDoowop
  • 111
  • 6
8
votes
2 answers

Why does perl6 multi default to sub?

In reference to this question / answer, perl6 multi defaults to sub. No such method for invocant of type I would have expected it to default to method. Please could someone explain the rationale for this?
librasteve
  • 6,832
  • 8
  • 30
8
votes
3 answers

Swift DispatchGroup notify before task finish

I'm using DispatchGroup to perform a task, but group.notify is being called before the task is completed. My code: let group = DispatchGroup() let queueImage = DispatchQueue(label: "com.image") let queueVideo = DispatchQueue(label:…
Victor
  • 109
  • 1
  • 2
  • 11
8
votes
1 answer

type/origin of R's 'as' function

R's S3 OO system is centered around generic functions that call methods depending on the class of the object the generic function is being called on. The crux is that the generic function calls the appropriate method, as opposed to other OO…
PejoPhylo
  • 469
  • 2
  • 11
1 2
3
64 65