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
18
votes
4 answers

target parameter in DispatchQueue

In Swift 3, the creation of a DispatchQueue instance: DispatchQueue(label: String, qos: DispatchQoS, attributes: DispatchQueue.Attributes, autoreleaseFrequency: DispatchQueue.AutoreleaseFrequency, …
pzs7602
  • 1,233
  • 1
  • 10
  • 9
17
votes
3 answers

Dispatch of `rbind` and `cbind` for a `data.frame`

Background The dispatch mechanism of the R functions rbind() and cbind() is non-standard. I explored some possibilities of writing rbind.myclass() or cbind.myclass() functions when one of the arguments is a data.frame, but so far I do not have a…
Stef van Buuren
  • 348
  • 1
  • 10
15
votes
1 answer

how to dynamically call instance methods in typescript?

I have an object and I want to dynamically call a method on it. Having typechecking would be nice but that maybe impossible. But I can't even get it to compile at all currently: const key: string = 'someMethod' const func = this[key] …
dcsan
  • 11,333
  • 15
  • 77
  • 118
15
votes
4 answers

JDI Event Dispatch nullpointerexception

When I try to debug on my device I sometimes get an error and the debugger doesn't stop on any breakpoint. Also, the application doesn't even start properly, it just freezes at kinda black screen with the app icon and name at the top. The error is a…
Fungijl
  • 153
  • 1
  • 1
  • 7
14
votes
4 answers

How can I write self-modifying code that runs efficiently on modern x64 processors?

I'm trying to speed up a variable-bitwidth integer compression scheme and I'm interested in generating and executing assembly code on-the-fly. Currently a lot of time is spent on mispredicted indirect branches, and generating code based on the…
Nathan Kurz
  • 1,649
  • 1
  • 14
  • 28
13
votes
4 answers

Why virtual function call is faster than dynamic_cast?

I wrote a simple example, which estimates average time of calling virtual function, using base class interface and dynamic_cast and call of non-virtual function. Here is it: #include #include #include #include…
D_E
  • 1,196
  • 11
  • 24
13
votes
2 answers

Threads and Thread Groups on the GPU

I'm wondering about the "grids" of threads/thread groups I can dispatch on the GPU. I'm using Direct Compute so I'll give a concrete example using that API. For example, if I call Dispatch(2,2,2), I understand it dispatches 2x2x2 = 8 thread groups…
l3utterfly
  • 2,106
  • 4
  • 32
  • 58
12
votes
3 answers

An internal error occurred during: "JDI Event Dispatch" java.lang.NullPointerException

I have my java applet codee,I am trying to debug using eclipse Indigo EE. I am trying to debug on remote using debug configuration and port. When I try to execute the application, it gives always an error message, An internal error occurred during:…
JSD
  • 121
  • 1
  • 4
12
votes
5 answers

Why BackgroundWorker always is busy?

I realized something strange in my background worker in my WPF application. What I'm trying to accomplish right now is to wait until the BW finishes to start another thread. Check the following code: if (bw.IsBusy) { bw.CancelAsync(); …
Darf Zon
  • 6,268
  • 20
  • 90
  • 149
11
votes
2 answers

dispatching S4 methods with an expression as argument

I'm trying to convince an S4 method to use an expression as an argument, but I always get an error returned. A trivial example that illustrates a bit what I'm trying to do here…
Joris Meys
  • 106,551
  • 31
  • 221
  • 263
11
votes
2 answers

Passing a "pointer to a virtual function" as argument in Python

Compare the following code in C++: #include #include struct A { virtual void bar(void) { std::cout << "one" << std::endl; } }; struct B : public A { virtual void bar(void) { std::cout << "two" << std::endl; } }; void…
Andrzej Pronobis
  • 33,828
  • 17
  • 76
  • 92
11
votes
1 answer

Generalizing `...` (three dots) argument dispatch: S4 methods for argument set including `...`

Actual question Is it possible to define methods for a set of signature arguments that includes ... (as opposed to exclusively for ...)? It's not possible "out-of-the-box", but would it theoretically be possible at all (involving some tweaks) or is…
Rappster
  • 12,762
  • 7
  • 71
  • 120
11
votes
4 answers

__iter__() implemented as a generator

I have an object subclass which implements a dynamic dispatch __ iter __ using a caching generator (I also have a method for invalidating the iter cache) like so: def __iter__(self): print("iter called") if self.__iter_cache is None: …
Emanuel Landeholm
  • 1,396
  • 1
  • 15
  • 21
10
votes
4 answers

Is it possible to dispatch events on regular objects (not DOM ones)?

I just found out that FileReader dispatches events just as if it was a DOM element. Is it? I wonder if it's possible to create an object similar to FileReader, which doesn't have a representation in HTML/XML structure, but can dispatch events?
jayarjo
  • 16,124
  • 24
  • 94
  • 138
10
votes
1 answer

How to dispatch an action to the redux-devtools store for importing a state from a component?

I'm currently trying to implement a panel integrated in my angular application which will allow me to import whatever json state file exported from redux-devtools using the same import feature as redux-devtools. My application is properly integrated…
Remi C
  • 109
  • 1
  • 5
1
2
3
64 65