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

What does Znwm and ZdlPv mean in assembly?

I'm new to assembly and I'm trying to figure out how C++ handles dynamic dispatch in assembly. When looking through assembly code, I saw that there were 2 unusual calls: call _Znwm call _ZdlPv These did not have a subroutine that I could trace…
user2999870
  • 345
  • 4
  • 12
8
votes
0 answers

JavaScript dispatch CustomEvent: new or reuse

I want to dispatch a CustomEvent on different occasions. Most examples on the net create and dispatch CustomEvents only once. I want to know how to do it correctly. In this example the "A-Button" dispatches the same event over and over again. The…
htho
  • 1,549
  • 1
  • 12
  • 33
8
votes
1 answer

Dispatch time forever in Swift 3

I have an app written in Swift 2. And there is a line like this. semaphore.wait(timeout: dispatch_time_t(DISPATCH_TIME_FOREVER)); but this line shows as an error in Swift 3. How can I convert this to Swift 3. Please help me. Thanks
user1960169
  • 3,533
  • 12
  • 39
  • 61
8
votes
2 answers

For Objective-C ... Pointer to method

I want to setup a Method dispatch table and I am wondering if it is possible to create pointer to a method in Objective-C (like pointer to function in C). I tried to use some Objective-C runtime functions to dynamically switch methods but the…
Mike Wong
7
votes
1 answer

How do I replace a switch statement over an enum with runtime-dynamic type-based generic dispatch in C#?

Background: I am building an editor extension for Unity (although this question is not strictly unity related). The user can select a binary operation from a dropdown and the operation is performed on the inputs, as seen in the diagram: The code…
7
votes
1 answer

Why does this rewrite to a Julia do block break when the lambda works?

I have this lambda style function call foldr((l,r) -> r+1, "12345"; init=0) which Julia happily computes as 5. Rewriting it to the do style looks like foldr("12345"; init=0) do (l,r) # I also tried ((l,r),) and just tup # l,r = tup # and…
primfaktor
  • 2,831
  • 25
  • 34
7
votes
1 answer

Whose witness table should be used?

I want to have a solid understanding of method dispatching in Swift. I read from this popular blog about the three types of dispatches as below: Dynamic Table(Witness table in Swift) Message In that blog the author says that the NSObject subtypes…
Rohan Bhale
  • 1,323
  • 1
  • 11
  • 29
7
votes
1 answer

Overriding method call operator or some other way to catch method name resolution errors

I am trying to write an example for the X::NYI class as a response to this issue. I have come up with something like this: class Nothing { sub postfix:<.&>( $sub, **@args) { die X::NYI.new( feature => $sub, …
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
7
votes
2 answers

React Redux: Cannot read property 'dispatch' of undefined

I have been working on this for long but didn't find a solution: I get Cannot read property 'dispatch' of undefined whenever the handleInputChange function is called. This is the basic layout of my app: App.tsx import * as React from…
sachsure
  • 828
  • 1
  • 17
  • 30
7
votes
2 answers

how to know if tag is present?

Good morning, I would like to use the write method I found on the page: https://developer.android.com/guide/topics/connectivity/nfc/advanced-nfc.html, to write on an ultralight mifare. I have not yet succeeded. public void writeTag(Tag tag,…
Antilope
  • 443
  • 2
  • 6
  • 17
7
votes
2 answers

jQuery dispatch event? How to

how can i dispatch an event on my window ready? For example in my code i've got: $("#info").click(function(){ // do stuff }); I need to call this function the first time without have a click on #info, in the way // do stuff.
davidino
  • 231
  • 2
  • 4
  • 6
7
votes
3 answers

c# Generic overloaded method dispatching ambiguous

I just hit a situation where a method dispatch was ambiguous and wondered if anyone could explain on what basis the compiler (.NET 4.0.30319) chooses what overload to call interface IfaceA { } interface IfaceB { void Add(IfaceA a); T…
Sebastian
  • 6,293
  • 6
  • 34
  • 47
7
votes
1 answer

How to provide input to a webView input field programmatically in Android Kitkat (4.4)

I need to provide input to a webview input control programmatically. For that I was using webView.dispatchKeyEvent() and it worked fine till Android 4.3 version but it is not working in 4.4 version (Kitkat - Chromium webView). I see the below…
AndroidDev
  • 5,193
  • 5
  • 37
  • 68
7
votes
5 answers

Best practices for Python if-elif-elif-elif when dispatching requests

I have 5 sets of request's categories defined as python dicts, for example: category1 = {'type1', 'type2', 'type3'} category2 = {'type4', 'type5'} category3 = {'type6', 'type7', 'type8', 'type9'} category4 = {'type10', 'type11'} category5 =…
Sergio Ayestarán
  • 5,590
  • 4
  • 38
  • 62
6
votes
4 answers

Signature can't be resolved when it's aliased to a constant

As a follow up to this question about using different APIs in a single program, Liz Mattijsen suggested to use constants. Now here's a different use case: let's try to create a multi that differentiates by API version, like this: class…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86