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

ViewController as Popup While Wait for Dispatch Semaphore

I am using a Dispatch Semaphore to wait while I make a URL JSON request, and this wait might take a while. To overcome this situation I decided to make a new view and show it as pop up while the request is being made. For that I used the code…
Skalwalker
  • 299
  • 3
  • 23
3
votes
1 answer

Return a method from a Go closure

I want to be able to dynamically generate a method ApiName for the following struct: type SomeCustomSObject struct { sobjects.BaseSObject } The interface I want to implement the method for is as follows: type SObject interface { ApiName()…
3
votes
0 answers

Swift: how to understand dynamic method dispatching in init method?

I find that the dynamic method dispatching in init method of Swift is different from which in C++, can anyone explain why? This is the demo code and its output: In Swift: class Object { init() { a() } func a() { print("Object") …
Josscii
  • 110
  • 7
3
votes
1 answer

React Redux how to dispatch async actions and update state

I try to deal with ajax data in my learning react,redux project and I have no idea how to dispatch an action and set the state inside a component here is my component import React, {PropTypes, Component} from 'react'; import Upload from…
fefe
  • 8,755
  • 27
  • 104
  • 180
3
votes
1 answer

In React with Redux, when should I save data to back end

In React with Redux, when there are some user operations, e.g., in facebook, user adds some comments, I will call dispatch() to send the add action to redux store, but when should I call back end API to save these data to database? do I need to do…
Benjamin Li
  • 1,687
  • 7
  • 19
  • 30
3
votes
1 answer

Playground - The relationship between DispatchQueue and DispatchSemaphore

I am confused with DispatchQueue and DispatchSemaphore.Like the following example: let semaphore : DispatchSemaphore = DispatchSemaphore(value:1) for i in 1...40 { DispatchQueue.global().async{ semaphore.wait() …
Leo
  • 835
  • 1
  • 12
  • 31
3
votes
1 answer

Understanding Dean Edwards' addevent JavaScript

I need help understanding this piece of code. What is the point of handler.guid? Why is there a need for a hash table? What is the point of: if ( element["on" + type]) { handlers[0] = element["on" + type]; } What does the "this" refer to…
steve
  • 1,871
  • 2
  • 12
  • 5
3
votes
2 answers

dispatch_async vs dispatch_sync in fetch data. Swift

After reading so many posts about parallel and concurrent, I still confuse what is the proper way to fetch data. For example, in my project, I have a button for user to fetch data. My code is something like below. var array = [Int]() func…
Pak Ho Cheung
  • 1,382
  • 6
  • 22
  • 52
3
votes
0 answers

python win32com Lotus Notes Dispatch error

I'm trying to use python to access Lotus Notes using the win32com module import win32com from win32com.client import Dispatch notesSession = Dispatch('Lotus.NotesSession') However, I get the following error message: pywintypes.com_error:…
Toby_w50
  • 51
  • 4
3
votes
1 answer

case or defmulti for closed-world, value-based dispatch?

Suppose I have a closed world of valid dispatch keys; in my concrete example, it's the type of nybbles. There are two obvious ways to define an operation of some parameters that behaves differently based on a nybble argument: Using case,…
Cactus
  • 27,075
  • 9
  • 69
  • 149
3
votes
1 answer

_cp_dispatch not getting called in cherrypy

In the following example, I would expect to get an exception when accessing url http://127.0.0.1:8080/b/method_b. Instead, I get normal http response containing text 'method_b' in browser. No exception raised, meaning that _cp_dispatcher is not…
collier
  • 111
  • 5
3
votes
2 answers

What are the limits on dynamic/double dispatch in Kotlin?

I'm just starting to explore Kotlin, and I'm curious about how far it moves beyond Java's core dynamic binding/dispatch semantics. Let's say I write code that looks something like this: class Animal { fun add(x:Animal) = Animal() } object Horse…
Mark McKenna
  • 2,857
  • 1
  • 17
  • 17
3
votes
3 answers

How can I queue a function to be invoked by the MainThread in C#?

I have found plenty of resources for how to invoke a function on the UI thread, but I have some logic that is only allowed to be run from the Main Thread. Is there a way to grab a dispatcher on the Main thread and invoke on it?
Psymunn
  • 376
  • 1
  • 9
3
votes
2 answers

dispatch_after or NSTimer?

I develop a method where each 3 seconds I show a image moving. I make with dispatch_after, but in each execution of the app, the distance or the time when the image is shown it's diferent. Is more efficient use an NSTimer with a Schedule??
PlugInBoy
  • 979
  • 3
  • 13
  • 25
3
votes
2 answers

How to approach debugging an AccessViolationException in a .Net application on XP

I have a .net application that I developed on a Windows 8.1 machine using Visual Studio Express 2008 compiled for .Net 4.0 It runs fine on the Windows 8.1 machine, but on a (very) old single core XP machine it occasionally throws an…