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
1 answer

Can I pass a Arc to a function that expects Arc?

In Rust for Rustaceans, Jon Gjengset states (emphasis mine): When you’re given the choice between static and dynamic dispatch, there is rarely a clear-cut right answer. Broadly speaking, though, you’ll want to use static dispatch in your libraries…
Anatoly Bugakov
  • 772
  • 1
  • 7
  • 18
4
votes
2 answers

How to use createAsyncThunk from Redux Toolkit with TypeScript correctly?

I want to create a Redux slice for the users inside the project I work on. I have this code sandbox and I do not know why there is the following error on the fetchAll call in the MyButton.tsx file: fetchAll(arg: any): AsyncThunkAction
silviubogan
  • 3,343
  • 3
  • 31
  • 57
4
votes
1 answer

How to monkey patch a generic type tag function table

I found it interesting to read on one of the ways that you can do functional dynamic dispatch in sicp - using a table of type tag + name -> functions that you can fetch from or add to. I was wondering, is this a typical type dispatch mechanism for a…
Roman A. Taycher
  • 18,619
  • 19
  • 86
  • 141
4
votes
4 answers

"Local" labels in C and jump table implementation

I'm trying to make a macro-based jump table in C. Here's some example code: #include "stdio.h" #define GOTO(X) static void* caseArg[] = {&&I0, &&R0, &&S0, &&F0, &&G0, &&H0}; \ goto *caseArg[X]; #define FINISH() goto caseEnd; int main(int…
Dr.Kameleon
  • 22,532
  • 20
  • 115
  • 223
4
votes
4 answers

Android NFC foreground dispatch problem

i'm completely new to android development and have to write a simple app for reading an nfc tag (with nexus s) for university. my problem is that when the nexus discoveres a tag, my app is not listed in the "select an action"-popup. the aim is to…
user746776
  • 41
  • 1
  • 1
  • 2
4
votes
3 answers

UI Dispatch Buffering?

I have a conundrum. I have "inherited" a very badly designed and very complex system which I am modernizing and rebuilding (with my team) piece-by-piece. The problem is that the current system is depended on by 200+ users, and they are having…
miguel
  • 2,961
  • 4
  • 26
  • 34
4
votes
2 answers

redux-saga: wait for dispatch to be completed

I'm using redux-saga to list and update a list of items stored in a remote server. And I would like to create an item and then to list the items. That is: import { connect } from 'react-redux' const NewItemDialog = ({ createItem, listItems }) => { …
Cequiel
  • 3,505
  • 6
  • 27
  • 44
4
votes
1 answer

Aurelia change state twice in one action

I am developing with aurelia and using aurelia-store for app state management. On loading data from server, I want to change an isLoading field true/false to show mask on related components. So I have defined a property in my state isLoading (for…
Mohammad RN
  • 131
  • 10
4
votes
1 answer

lodash throttle redux dispatch Uncaught TypeError: Expected a function

TL;DR I am running into strangeness with creating a throttled function where I need to pass parameters to this method manually while creating the throttled function. I can do this by changing my original function, but I don't want to do this for all…
Urasquirrel
  • 1,461
  • 1
  • 18
  • 34
4
votes
1 answer

Why is there an error CS1973 when trying to invoke extension method with dynamic argument

Consider the following code: internal static class Program { public static string ExtensionMethod(this string format, dynamic args) { return format + args.ToString(); } private static void Main() { string test =…
nvoigt
  • 75,013
  • 26
  • 93
  • 142
4
votes
1 answer

Interpretation vs dynamic dispatch penalty in Python

I watched Brandon Rhodes' talk about Cython - "The Day of the EXE Is Upon Us". Brandon mentions at 09:30 that for a specific short piece of code, skipping interpretation gave 40% speedup, while skipping the allocation and dispatch gave 574% speedup…
Jay
  • 2,535
  • 3
  • 32
  • 44
4
votes
2 answers

Actionscript 3: Sequence Diagrams for Event Handling

i have to draw some sequence diagrams for a software i wrote. In my Software i have some Objects that dispatch custom Events and other Objects that listens for these events. When it comes to illustrate Eventlisteners und dispatchEvent-function i'm a…
4
votes
4 answers

MBProgressHUD not show

When I write like this, it works as expected: override func viewDidLoad() { super.viewDidLoad() MBProgressHUD.showAdded(to: navigationController!.view, animated: true) } However, when I put it in DispatchQueue.main block, the hud doesn't…
a_tuo
  • 651
  • 7
  • 23
4
votes
3 answers

Any way to dispatch a closure in laravel 5?

In laravel 4, I could push a closure onto the queue with queue::push(function...), but this no longer works in laravel 5. Instead, it appears that I have to make a custom Job class for every function that I want to push onto the queue. Since the…
Benubird
  • 18,551
  • 27
  • 90
  • 141
4
votes
3 answers

Dispatch action on the callback of socket.on()

So basically I got this socket, that is working correctly sending me 'new order' message. I'm using redux, and i want to dispatch an action, than a reducer would get it and my store would be updated. but this code doesn't do anything! socket.on('new…
Amanda Siqueira
  • 75
  • 1
  • 2
  • 7