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

Clojure multimethod dispath problem

I have those two sources: (ns odo.IComplex) (gen-interface :name odo.IComplex :methods [ [getReal [] Double] [getImag [] Double] [getAbs [] Double] [getArg [] Double] [setReal [Double] void] …
Odomontois
  • 15,918
  • 2
  • 36
  • 71
4
votes
1 answer

AFNetworking 3.1.0 and dispatch groups

AFHTTPSessionManager GET:... does not perform it's blocks when dispatch group waits. dispatch_group_wait waits really "FOREVER". In my code @"all done" never happens. How can I make it work? (sorry. as I see, most people are interested to know the…
4
votes
1 answer

How can I programmatically determine which class/module defines a method being called?

In Ruby, how can I programmatically determine which class/module defines a method being called? Say in a given scope I invoke some_method(). In the same scope I'd like to invoke a function find_method(:some_method) that would return which Class,…
Alex Boisvert
  • 2,850
  • 2
  • 19
  • 18
4
votes
2 answers

How to hook up a COM event dispatcher?

The VBIDE API exposes the wonderfully cryptic _dispVBComponentsEvents interface (among others), which look like something that I could use to capture various interesting events in the VBE. So I implemented the interface in a class that intends to…
Mathieu Guindon
  • 69,817
  • 8
  • 107
  • 235
4
votes
1 answer

How to implement iter method using static/dynamic dispatch?

I need to implement the method iter, which returns something which implements the trait Iterator. But the return value will be different implementations, depending on the enum variant. Something like this: pub enum Class { …
Aleksandr
  • 1,303
  • 2
  • 11
  • 19
4
votes
0 answers

Akka several actors share single pinned-dispatcher

I'm looking for a solution, where several actors should sit on single thread. In this thread I have OpenGL context and I want to separate resource creation code (e.g. shader compilation) from resource using code (e.g. rendering loop). Is this…
Seagull
  • 13,484
  • 2
  • 33
  • 45
4
votes
2 answers

dispatch_sync inside dispatch_sync causes deadlock

I just read this on objc.io Going Fully Asynchronous but can't find good explanation dispatch_queue_t queueA; // assume we have this dispatch_sync(queueA, ^(){ // (a) dispatch_sync(queueA, ^(){ // (b) foo(); }); }); Once we hit…
onmyway133
  • 45,645
  • 31
  • 257
  • 263
4
votes
3 answers

Is this design using dynamic okay?

I've got a list of different jobs to process in my application. I'm toying with a design which uses different types to represent different types of job - this is natural because they have different properties and so on. For processing I was thinking…
Daniel James Bryars
  • 4,429
  • 3
  • 39
  • 57
4
votes
4 answers

bash: partial match up to a complete word for case

I wrote a bash script that takes a command as the first positional parameter and uses a case construct as a dispatch similar to the following: do_command() { # responds to invocation `$0 command ...` } do_copy() { # respond to invocation: `$0…
Iron Savior
  • 4,238
  • 3
  • 25
  • 30
4
votes
1 answer

define S4 method with 3 dots

I am trying to define the "c" method for an object I created. something like setMethod("c", signature(...), definition=function (...) { myObject = list(...)[[1]] myObject@mySlot=lapply(list(...), FUN =…
RockScience
  • 17,932
  • 26
  • 89
  • 125
4
votes
1 answer

What's the difference between performing an NSURLRequest and responding to delegates as opposed to using dispatch_async?

I'm trying to get my head around a asynchronicity; dispatch, multiple threads, run loops etc etc. What's the difference between: 1) creating an NSURLRequest and NSURLConnection in a given method, and having it execute and us responding to the…
Madivad
  • 2,999
  • 7
  • 33
  • 60
4
votes
0 answers

Android: How do I intercept a touch event on a DialogFragment?

How do I intercept a touch event on a DialogFragment before it is dispatched to the dialog ? When I want to intercept a touch event on an Activity I override dispatchTouchEvent(MotionEvent ev) for that Activity. How can I do something similar for a…
andreea
  • 3,425
  • 2
  • 18
  • 10
4
votes
2 answers

InputDispatcher: Dropped event because input dispatch is disabled

I am developing ui automation platform for android. For some reason sometimes (very rare) click events can be dropped When it happen I see in log I/InputDispatcher( 2707): Dropped event because input dispatch is disabled. Please advise what can be…
Sergey Tolkachov
  • 61
  • 1
  • 1
  • 6
4
votes
1 answer

win32com.client.Dispatch works but not win32com.client.gencache.EnsureDispatch

i'm learning win32com for python and I've got a strange problem. I'e trying to export Outlook Contacts in a List of Dictionnary. My code works perfectly with win32com.client.Dispatch("Outlook.Application). But it returns 0 contacts with…
franckgaga
  • 81
  • 1
  • 1
  • 7
4
votes
4 answers

dispatch_after looped / repeated

I am trying to create a loop like this: while (TRUE){ dispatch_after(...{ }); } After a viewDidLoad. The idea is to repeat the dispatch_after repeatedly. The dispatch_after waits two seconds before doing the action. This does…
Roel Van de Paar
  • 2,111
  • 1
  • 24
  • 38