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
2
votes
0 answers

Creating docs for dispatched functions using Sphinx

I am using the multipledispatch package in order to dispatch some functions. I created meaningful docstrings for every function. The code just runs fine. # md.py from multipledispatch import dispatch @dispatch(int, int) def calc(a: int, b: int)…
Andi
  • 3,196
  • 2
  • 24
  • 44
2
votes
0 answers

Laravel 8 "Queue::push" is working, but "dispatch" is not

I'm facing an issue with Laravel queued jobs. I'm using Laravel v8.40.0 with Redis v6.2.5 and Horizon v5.7.14 for managing jobs. I have a job class called MyJob which should write a message in log file. If I use Queue::push(new MyJob()) everything…
2
votes
1 answer

Get updated redux state after dispatch

This is my reducer.js const initialState = { counter: 0 } const reducer = (state = initialState, action) => { switch (action.type) { case 'increase': state = { ...state, counter: state.counter + 1 } break …
Dimisizz
  • 69
  • 9
2
votes
2 answers

error at react redux combinereducer with typescript

I'm trying to learn redux by making a to-do list but i am getting an error and i couldn't solve this problem my types export interface TodoType { text: string; id: number; } export interface TodoState { todoList: TodoType[]; } interface…
1sahinomer1
  • 119
  • 6
2
votes
3 answers

Pythonic way to call different methods for each setting in a configuration screen

I am currently designing a configuration screen for my application. There are about 50 configuration parameters, which I have described in a CSV file, and read in Python. Currently the fields for each parameter row…
Mats de Waard
  • 139
  • 2
  • 15
2
votes
1 answer

Why doesn't my try catch block handle dispatch error?

I can't get a rejected promise in my try catch block, it's response is always in the originalPromiseResult Here is the slice where I get some data from the API: export const getData = createAsyncThunk( 'user/getData', async (headers, {…
user3189117
  • 35
  • 1
  • 4
2
votes
0 answers

PasteSpecial method of Range class failed when copying a range from one Excel to another using Python

I'm trying to copy a range from one excel spreadsheet to another using a for loop but keep getting an error message. I'm using win32com and python to make the copy. Here is a snippet of my code params_columns = [1,3,5] for x in params_columns: …
Major Anarchy
  • 17
  • 1
  • 4
2
votes
4 answers

How to dispatch click event in Android

I have a custom navigation bar that contains a button, I would dispatch the click event so that the activity that contains my navigation bar can respond to click public class BarrePersonnalisee extends LinearLayout implements OnClickListener { …
alikyo
  • 56
  • 1
  • 5
2
votes
2 answers

Confusing method bindings

The output of this simple program is This is base. public class mainApp{ private void func(){ System.out.println("This is base"); } public static void main(String[] args){ mainApp newObj = new derived(); …
Quazi Irfan
  • 2,555
  • 5
  • 34
  • 69
2
votes
1 answer

Sequential dispatch action in react-redux hook

I am using the useDispatch() function to return me a dispatch object to fire some actions. I have a particular scenario in which I want to fire a reject-action that cancels a user's request and after getting back the response from the server…
AKJ
  • 749
  • 6
  • 29
2
votes
1 answer

useSelector and UseEffect with dispatch functions create loop due to not updating state

I am trying to develop a React application that shows a list of items using Hooks but an infinite loop is happening. I think the state is not being identified as updated but I cannot tell why. I have seen at the documentation that it could be the…
Catarina Nogueira
  • 1,024
  • 2
  • 12
  • 28
2
votes
2 answers

useReducer and useContext Dispatch doesn't work in onClick function

I'll spare you the broader context as it's pretty simple. Using React hooks, the first dispatch here fires automatically and works just fine, but the second one doesn't. Context is imported from another file, so I assume it's a (lowercase) context…
Michael Heilemann
  • 2,627
  • 4
  • 23
  • 28
2
votes
1 answer

Redux async actions: Does it make any difference to put initial dispatch into the try block?

Consider I am making a pretty generic api call using redux async action. There is an "INIT" dispatch and either "SUCCESS" or "FAILURE", regarding of the result. Does it make any difference to put the "INIT" dispatch into the try catch block? OPTION…
HynekS
  • 2,738
  • 1
  • 19
  • 34
2
votes
1 answer

Swift Dispatch Main

I have code that I am repeating a bunch. I want to update things on the main thread, UI stuff. public func closeGraph() { DispatchQueue.main.sync{_closeGraph()} } That's easy enough, but what if user interaction triggers it and I am already on…
MongoTheGeek
  • 294
  • 1
  • 10
2
votes
2 answers

How to dispatch based on the type of any of the splatted args?

Consider an existing function in Base, which takes in a variable number of arguments of some abstract type T. I have defined a subtype S<:T and would like to write a method which dispatches if any of the arguments is my subtype S. As an example,…
miha priimek
  • 919
  • 6
  • 20