SlideShare a Scribd company logo
•
•
•
•
•
•
•
•

Introduction
Understanding
Datatype and practical use
Dynamic dispatch study
Multiple dispatch examples
Pythons
Languages supporting dispatches
Multimethods in other languages via
extentions
•
•
•
•
•

Multiple dispatch or multimethods or function overloading is the feature
of object-oriented programming languages
which a function or method can be dynamically dispatched based on the
run time (dynamic) type of more than one of its arguments.
It is an extension of single dispatch polymorphism
In which method call is dynamically dispatched based on the actual
derived type of the object on which the method has been called.
Multiple dispatch generalizes the dynamic dispatching to work with a
combination of two or more objects.
When Several functions having same name in such cases,
the name at the function call site is not sufficient for
identifying the code to be executed .Here the dispatchment
arrises.
• single-dispatch OOP languages when invoking a method
(“function calling”) one of its arguments is treated specially
and used to determine which of the methods of that name is
to be called.
FOR EG:-special .method (other, arguments, here);
• By contrast, in languages with multiple dispatch, the
selected method is the one whose arguments match the
number and function call type.
• There is no "special" argument that "owns" the
function/method carried out in a particular call.
• Such as Common Lisp Object System (CLOS) is latest
example of multiple dispatch.
• programming languages that defer data type identification
until run-time,
• the selection among alternative functions must occur at
run-time, based on the dynamically determined types of
function arguments.
• Functions whose alternative implementations are selected
in this manner are referred to most generally as
multimethods.
• there is some run-time cost associated with dynamically
dispatching function call.
•

the distinction between overloading and multimethods can
be blurred,
• the compiler determining whether compile-time selection
can be applied to a given function call, or whether slower
run-time dispatch is needed.
•
•
•
•

•

dynamic dispatch in mostly compilers languages was studied and the
results stated that
13%-32% of generic functions utilize the dynamic type of a single
argument,
while 2.7%-6.5% of them utilize the dynamic type of multiple
arguments.
remaining 65%-93% of generic functions have a single concrete method
(overrider), and therefore are not considered to use the dynamic types
of their arguments.
In addition, the study reports that 2%-20% of generic functions had two
and 3%-6% had three concrete function implementations.
•

•
•
•
•

In the presence of multiple dispatch, the traditional idea of methods as
being defined in classes and contained in objects becomes less appealing
—
each collide-with method there is attached to two different classes, not
one.
Hence, the special syntax for method invocation generally disappears, so
that method invocation looks exactly like ordinary function invocation
methods are grouped not in classes but in generic functions.
AS IN multiple dispatch, such as Common Lisp, it
•

In languages that do not support multiple dispatch at the language definition or syntactic
level, it is often possible to add multiple dispatch using a library extension.

•

For example, the module multimethods.py provides CLOS-style multimethods for Python
without changing the underlying syntax or keywords of the language.

•

•

Multiple dispatch or multimethods or function overloading is the feature of some
object-oriented langages in which a function or method can be dynamically dispatched
based on the run time (dynamic) type of more than one of its arguments.
This is an extension of single dispatch polymorphism where a method call is dynamically
dispatched based on the actual derived type of the object on which the method has been
called. Multiple dispatch generalizes the dynamic dispatching to work with a combination
of two or more objects.
EXAMPLE OF MULTIPLE DISPATCH
•

•
•

•
•

C does not have dynamic dispatch, Often an enum is used to identify the
subtype of an object. Dynamic dispatch can be done by looking up this
value in a function pointer branch table.
EX:-typedef enum { asteroid = 0, spaceship } Thing;
C++ is being considered,[3] currently C++ only supports single dispatch
natively. The methods of working around this limitation are analogous;
either use the visitor pattern, double dispatch, dynamic cast:
it can be approximately implemented using double dispatch or a type
based lookup table as outlined in the C/C++
JAVA supports only single dispatch and code like visitor pattern helps
to solve this problem of its implementatiopn
•
•
•
•
•
•
•
•
•
•
•
•
•
•

PRogramming languages that support general multimethods:
Common Lisp (via the Common Lisp Object System)
Haskell via Multi-parameter type classes
Dylan
Nice
Cecil
R
Groovy
Perl 6
Seed7
Clojure
C# 4.0
Fortress
TADS
Multimethods in other languages via
extensions:
•
•
•
•
•
•
•
•

Scheme (via e.g. TinyCLOS)
Python (via PEAK-Rules, RuleDispatch, gnosis.magic.multimethods, or
PyMultimethods)
Perl (via the module Class::Multimethods)
Java (using the extension MultiJava)
Ruby (via the library The Multiple Dispatch Library and
Multimethod Package and Vlx-Multimethods Package)
.NET (via the library MultiMethods.NET)
C# (via the library multimethod-sharp)
Factor (via the standard multi-methods vocabulary)
multiple dispatch(OOPs concepts)
multiple dispatch(OOPs concepts)

More Related Content

What's hot

Text Categorization Using Improved K Nearest Neighbor Algorithm
Text Categorization Using Improved K Nearest Neighbor AlgorithmText Categorization Using Improved K Nearest Neighbor Algorithm
Text Categorization Using Improved K Nearest Neighbor Algorithm
IJTET Journal
 
Polymorphism and its types
Polymorphism and its typesPolymorphism and its types
Polymorphism and its types
Suraj Bora
 
Text classification-php-v4
Text classification-php-v4Text classification-php-v4
Text classification-php-v4
Glenn De Backer
 
Polymorphism in oop
Polymorphism in oopPolymorphism in oop
Polymorphism in oop
MustafaIbrahimy
 
Text categorization as graph
Text categorization as graphText categorization as graph
Text categorization as graph
Harry Potter
 
Tdm probabilistic models (part 2)
Tdm probabilistic  models (part  2)Tdm probabilistic  models (part  2)
Tdm probabilistic models (part 2)
KU Leuven
 
Polymorphism in java
Polymorphism in java Polymorphism in java
Polymorphism in java
Janu Jahnavi
 
Unit 1
Unit  1Unit  1
Unit 1
donny101
 
Polymorphism in java
Polymorphism in javaPolymorphism in java
Polymorphism in java
sureshraj43
 
Probabilistic content models,
Probabilistic content models,Probabilistic content models,
Probabilistic content models,
Bryan Gummibearehausen
 
Presentation 2nd
Presentation 2ndPresentation 2nd
Presentation 2nd
Connex
 
Implementation
ImplementationImplementation
Implementation
adil raja
 
Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...
Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...
Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...
cprogrammings
 
Generics
GenericsGenerics
Generics
adil raja
 
Text categorization
Text categorizationText categorization
Text categorization
Shubham Pahune
 
Oo Design And Patterns
Oo Design And PatternsOo Design And Patterns
Oo Design And Patterns
Anil Bapat
 
Classifying Text using CNN
Classifying Text using CNNClassifying Text using CNN
Classifying Text using CNN
Somnath Banerjee
 
Graph Techniques for Natural Language Processing
Graph Techniques for Natural Language ProcessingGraph Techniques for Natural Language Processing
Graph Techniques for Natural Language Processing
Sujit Pal
 
Myanmar Named Entity Recognition with Hidden Markov Model
Myanmar Named Entity Recognition with Hidden Markov ModelMyanmar Named Entity Recognition with Hidden Markov Model
Myanmar Named Entity Recognition with Hidden Markov Model
ijtsrd
 
Canonical Formatted Address Data
Canonical Formatted Address DataCanonical Formatted Address Data
Canonical Formatted Address Data
danielschulz2005
 

What's hot (20)

Text Categorization Using Improved K Nearest Neighbor Algorithm
Text Categorization Using Improved K Nearest Neighbor AlgorithmText Categorization Using Improved K Nearest Neighbor Algorithm
Text Categorization Using Improved K Nearest Neighbor Algorithm
 
Polymorphism and its types
Polymorphism and its typesPolymorphism and its types
Polymorphism and its types
 
Text classification-php-v4
Text classification-php-v4Text classification-php-v4
Text classification-php-v4
 
Polymorphism in oop
Polymorphism in oopPolymorphism in oop
Polymorphism in oop
 
Text categorization as graph
Text categorization as graphText categorization as graph
Text categorization as graph
 
Tdm probabilistic models (part 2)
Tdm probabilistic  models (part  2)Tdm probabilistic  models (part  2)
Tdm probabilistic models (part 2)
 
Polymorphism in java
Polymorphism in java Polymorphism in java
Polymorphism in java
 
Unit 1
Unit  1Unit  1
Unit 1
 
Polymorphism in java
Polymorphism in javaPolymorphism in java
Polymorphism in java
 
Probabilistic content models,
Probabilistic content models,Probabilistic content models,
Probabilistic content models,
 
Presentation 2nd
Presentation 2ndPresentation 2nd
Presentation 2nd
 
Implementation
ImplementationImplementation
Implementation
 
Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...
Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...
Polymorphism in c++ ppt (Powerpoint) | Polymorphism in c++ with example ppt |...
 
Generics
GenericsGenerics
Generics
 
Text categorization
Text categorizationText categorization
Text categorization
 
Oo Design And Patterns
Oo Design And PatternsOo Design And Patterns
Oo Design And Patterns
 
Classifying Text using CNN
Classifying Text using CNNClassifying Text using CNN
Classifying Text using CNN
 
Graph Techniques for Natural Language Processing
Graph Techniques for Natural Language ProcessingGraph Techniques for Natural Language Processing
Graph Techniques for Natural Language Processing
 
Myanmar Named Entity Recognition with Hidden Markov Model
Myanmar Named Entity Recognition with Hidden Markov ModelMyanmar Named Entity Recognition with Hidden Markov Model
Myanmar Named Entity Recognition with Hidden Markov Model
 
Canonical Formatted Address Data
Canonical Formatted Address DataCanonical Formatted Address Data
Canonical Formatted Address Data
 

Viewers also liked

الشهادتان
الشهادتانالشهادتان
الشهادتان
zulabook
 
ооо колибри строительная компания
ооо колибри строительная компанияооо колибри строительная компания
ооо колибри строительная компанияAqil Aliyev
 
GelecekHane Ticaret 2.0 - Mark Holenstein Sap
GelecekHane Ticaret 2.0 - Mark Holenstein SapGelecekHane Ticaret 2.0 - Mark Holenstein Sap
GelecekHane Ticaret 2.0 - Mark Holenstein Sap
Gelecek Hane
 
Shnasy Deals Supplies with Friends
Shnasy Deals Supplies with FriendsShnasy Deals Supplies with Friends
Shnasy Deals Supplies with Friends
mrsbubba33
 
AMA SUNDAY NIGHT AUCTION 12/29/2013 JEWELRY MAKING SUPPLIES
AMA SUNDAY NIGHT AUCTION 12/29/2013 JEWELRY MAKING SUPPLIESAMA SUNDAY NIGHT AUCTION 12/29/2013 JEWELRY MAKING SUPPLIES
AMA SUNDAY NIGHT AUCTION 12/29/2013 JEWELRY MAKING SUPPLIES
mrsbubba33
 
Norway
NorwayNorway
Norway
schreiber12
 
microwaves by peer aakif
microwaves by peer aakifmicrowaves by peer aakif
microwaves by peer aakif
peeraakif
 
Bc kertas 1
Bc kertas 1Bc kertas 1
Bc kertas 1
Jocelyn Ng
 
English presentation
English presentationEnglish presentation
English presentation
Ragadian S'
 
Tuesday night owl! 1.21
Tuesday night owl! 1.21Tuesday night owl! 1.21
Tuesday night owl! 1.21
mrsbubba33
 
Maker Workshop 7 May 2014 - StudioX
Maker Workshop 7 May 2014 - StudioXMaker Workshop 7 May 2014 - StudioX
Maker Workshop 7 May 2014 - StudioX
Gelecek Hane
 
الكفاح المسلح
الكفاح المسلحالكفاح المسلح
الكفاح المسلح
zulabook
 
Christmas in norway
Christmas in norwayChristmas in norway
Christmas in norway
schreiber12
 
Engineering project management
Engineering project managementEngineering project management
Engineering project management
Gautam Shah
 
Corporate presentation (april 2015)
Corporate presentation (april 2015)Corporate presentation (april 2015)
Corporate presentation (april 2015)
oncolyticsinc
 
Time finished
Time finishedTime finished
Time finished
AliciaRhodes11
 

Viewers also liked (17)

4/3
4/34/3
4/3
 
الشهادتان
الشهادتانالشهادتان
الشهادتان
 
ооо колибри строительная компания
ооо колибри строительная компанияооо колибри строительная компания
ооо колибри строительная компания
 
GelecekHane Ticaret 2.0 - Mark Holenstein Sap
GelecekHane Ticaret 2.0 - Mark Holenstein SapGelecekHane Ticaret 2.0 - Mark Holenstein Sap
GelecekHane Ticaret 2.0 - Mark Holenstein Sap
 
Shnasy Deals Supplies with Friends
Shnasy Deals Supplies with FriendsShnasy Deals Supplies with Friends
Shnasy Deals Supplies with Friends
 
AMA SUNDAY NIGHT AUCTION 12/29/2013 JEWELRY MAKING SUPPLIES
AMA SUNDAY NIGHT AUCTION 12/29/2013 JEWELRY MAKING SUPPLIESAMA SUNDAY NIGHT AUCTION 12/29/2013 JEWELRY MAKING SUPPLIES
AMA SUNDAY NIGHT AUCTION 12/29/2013 JEWELRY MAKING SUPPLIES
 
Norway
NorwayNorway
Norway
 
microwaves by peer aakif
microwaves by peer aakifmicrowaves by peer aakif
microwaves by peer aakif
 
Bc kertas 1
Bc kertas 1Bc kertas 1
Bc kertas 1
 
English presentation
English presentationEnglish presentation
English presentation
 
Tuesday night owl! 1.21
Tuesday night owl! 1.21Tuesday night owl! 1.21
Tuesday night owl! 1.21
 
Maker Workshop 7 May 2014 - StudioX
Maker Workshop 7 May 2014 - StudioXMaker Workshop 7 May 2014 - StudioX
Maker Workshop 7 May 2014 - StudioX
 
الكفاح المسلح
الكفاح المسلحالكفاح المسلح
الكفاح المسلح
 
Christmas in norway
Christmas in norwayChristmas in norway
Christmas in norway
 
Engineering project management
Engineering project managementEngineering project management
Engineering project management
 
Corporate presentation (april 2015)
Corporate presentation (april 2015)Corporate presentation (april 2015)
Corporate presentation (april 2015)
 
Time finished
Time finishedTime finished
Time finished
 

Similar to multiple dispatch(OOPs concepts)

2CPP11 - Method Overloading
2CPP11 - Method Overloading2CPP11 - Method Overloading
2CPP11 - Method Overloading
Michael Heron
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Nadeesha Thilakarathne
 
C++ first s lide
C++ first s lideC++ first s lide
C++ first s lide
Sudhriti Gupta
 
30csharp
30csharp30csharp
30csharp
Sireesh K
 
30c
30c30c
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
Ahmed Farag
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
Ducat India
 
Java OOP s concepts and buzzwords
Java OOP s concepts and buzzwordsJava OOP s concepts and buzzwords
Java OOP s concepts and buzzwords
Raja Sekhar
 
De-virtualizing virtual Function Calls using various Type Analysis Technique...
De-virtualizing virtual Function Calls using various Type  Analysis Technique...De-virtualizing virtual Function Calls using various Type  Analysis Technique...
De-virtualizing virtual Function Calls using various Type Analysis Technique...
IOSR Journals
 
Review of c_sharp2_features_part_ii
Review of c_sharp2_features_part_iiReview of c_sharp2_features_part_ii
Review of c_sharp2_features_part_ii
Nico Ludwig
 
C++ Basics
C++ BasicsC++ Basics
C++ Basics
Himanshu Sharma
 
Java-Intro.pptx
Java-Intro.pptxJava-Intro.pptx
Java-Intro.pptx
VijalJain3
 
A Case Study on Java. Java Presentation
A Case Study on Java. Java Presentation A Case Study on Java. Java Presentation
A Case Study on Java. Java Presentation
Ayush Gupta
 
Object Oriented Programming Overview for the PeopleSoft Developer
Object Oriented Programming Overview for the PeopleSoft DeveloperObject Oriented Programming Overview for the PeopleSoft Developer
Object Oriented Programming Overview for the PeopleSoft Developer
Lee Greffin
 
11.C++Polymorphism [Autosaved].pptx
11.C++Polymorphism [Autosaved].pptx11.C++Polymorphism [Autosaved].pptx
11.C++Polymorphism [Autosaved].pptx
AtharvPotdar2
 
C++ concept of Polymorphism
C++ concept of  PolymorphismC++ concept of  Polymorphism
C++ concept of Polymorphism
kiran Patel
 
Subprogram
SubprogramSubprogram
Subprogram
baran19901990
 
walkmod - JUG talk
walkmod - JUG talkwalkmod - JUG talk
walkmod - JUG talk
walkmod
 
Presentation on polymorphism in c++.pptx
Presentation on polymorphism in c++.pptxPresentation on polymorphism in c++.pptx
Presentation on polymorphism in c++.pptx
vishwadeep15
 
Basics of object oriented programming
Basics of object oriented programmingBasics of object oriented programming
Basics of object oriented programming
Nitin Kumar Kashyap
 

Similar to multiple dispatch(OOPs concepts) (20)

2CPP11 - Method Overloading
2CPP11 - Method Overloading2CPP11 - Method Overloading
2CPP11 - Method Overloading
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
C++ first s lide
C++ first s lideC++ first s lide
C++ first s lide
 
30csharp
30csharp30csharp
30csharp
 
30c
30c30c
30c
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Java OOP s concepts and buzzwords
Java OOP s concepts and buzzwordsJava OOP s concepts and buzzwords
Java OOP s concepts and buzzwords
 
De-virtualizing virtual Function Calls using various Type Analysis Technique...
De-virtualizing virtual Function Calls using various Type  Analysis Technique...De-virtualizing virtual Function Calls using various Type  Analysis Technique...
De-virtualizing virtual Function Calls using various Type Analysis Technique...
 
Review of c_sharp2_features_part_ii
Review of c_sharp2_features_part_iiReview of c_sharp2_features_part_ii
Review of c_sharp2_features_part_ii
 
C++ Basics
C++ BasicsC++ Basics
C++ Basics
 
Java-Intro.pptx
Java-Intro.pptxJava-Intro.pptx
Java-Intro.pptx
 
A Case Study on Java. Java Presentation
A Case Study on Java. Java Presentation A Case Study on Java. Java Presentation
A Case Study on Java. Java Presentation
 
Object Oriented Programming Overview for the PeopleSoft Developer
Object Oriented Programming Overview for the PeopleSoft DeveloperObject Oriented Programming Overview for the PeopleSoft Developer
Object Oriented Programming Overview for the PeopleSoft Developer
 
11.C++Polymorphism [Autosaved].pptx
11.C++Polymorphism [Autosaved].pptx11.C++Polymorphism [Autosaved].pptx
11.C++Polymorphism [Autosaved].pptx
 
C++ concept of Polymorphism
C++ concept of  PolymorphismC++ concept of  Polymorphism
C++ concept of Polymorphism
 
Subprogram
SubprogramSubprogram
Subprogram
 
walkmod - JUG talk
walkmod - JUG talkwalkmod - JUG talk
walkmod - JUG talk
 
Presentation on polymorphism in c++.pptx
Presentation on polymorphism in c++.pptxPresentation on polymorphism in c++.pptx
Presentation on polymorphism in c++.pptx
 
Basics of object oriented programming
Basics of object oriented programmingBasics of object oriented programming
Basics of object oriented programming
 

Recently uploaded

CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
blueshagoo1
 
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGHKHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
shreyassri1208
 
BPSC-105 important questions for june term end exam
BPSC-105 important questions for june term end examBPSC-105 important questions for june term end exam
BPSC-105 important questions for june term end exam
sonukumargpnirsadhan
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
nitinpv4ai
 
Ch-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdfCh-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdf
lakshayrojroj
 
Observational Learning
Observational Learning Observational Learning
Observational Learning
sanamushtaq922
 
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
220711130083 SUBHASHREE RAKSHIT  Internet resources for social science220711130083 SUBHASHREE RAKSHIT  Internet resources for social science
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
Kalna College
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
Iris Thiele Isip-Tan
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
 
220711130100 udita Chakraborty Aims and objectives of national policy on inf...
220711130100 udita Chakraborty  Aims and objectives of national policy on inf...220711130100 udita Chakraborty  Aims and objectives of national policy on inf...
220711130100 udita Chakraborty Aims and objectives of national policy on inf...
Kalna College
 
adjectives.ppt for class 1 to 6, grammar
adjectives.ppt for class 1 to 6, grammaradjectives.ppt for class 1 to 6, grammar
adjectives.ppt for class 1 to 6, grammar
7DFarhanaMohammed
 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapitolTechU
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptxA Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
OH TEIK BIN
 
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
ShwetaGawande8
 
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptxContiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Kalna College
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】
欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】
欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】
andagarcia212
 
Simple-Present-Tense xxxxxxxxxxxxxxxxxxx
Simple-Present-Tense xxxxxxxxxxxxxxxxxxxSimple-Present-Tense xxxxxxxxxxxxxxxxxxx
Simple-Present-Tense xxxxxxxxxxxxxxxxxxx
RandolphRadicy
 

Recently uploaded (20)

CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
 
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGHKHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
KHUSWANT SINGH.pptx ALL YOU NEED TO KNOW ABOUT KHUSHWANT SINGH
 
BPSC-105 important questions for june term end exam
BPSC-105 important questions for june term end examBPSC-105 important questions for june term end exam
BPSC-105 important questions for june term end exam
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
 
Ch-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdfCh-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdf
 
Observational Learning
Observational Learning Observational Learning
Observational Learning
 
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
220711130083 SUBHASHREE RAKSHIT  Internet resources for social science220711130083 SUBHASHREE RAKSHIT  Internet resources for social science
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
 
220711130100 udita Chakraborty Aims and objectives of national policy on inf...
220711130100 udita Chakraborty  Aims and objectives of national policy on inf...220711130100 udita Chakraborty  Aims and objectives of national policy on inf...
220711130100 udita Chakraborty Aims and objectives of national policy on inf...
 
adjectives.ppt for class 1 to 6, grammar
adjectives.ppt for class 1 to 6, grammaradjectives.ppt for class 1 to 6, grammar
adjectives.ppt for class 1 to 6, grammar
 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptxA Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
 
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
 
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptxContiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptx
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】
欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】
欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】
 
Simple-Present-Tense xxxxxxxxxxxxxxxxxxx
Simple-Present-Tense xxxxxxxxxxxxxxxxxxxSimple-Present-Tense xxxxxxxxxxxxxxxxxxx
Simple-Present-Tense xxxxxxxxxxxxxxxxxxx
 

multiple dispatch(OOPs concepts)

  • 1.
  • 2. • • • • • • • • Introduction Understanding Datatype and practical use Dynamic dispatch study Multiple dispatch examples Pythons Languages supporting dispatches Multimethods in other languages via extentions
  • 3. • • • • • Multiple dispatch or multimethods or function overloading is the feature of object-oriented programming languages which a function or method can be dynamically dispatched based on the run time (dynamic) type of more than one of its arguments. It is an extension of single dispatch polymorphism In which method call is dynamically dispatched based on the actual derived type of the object on which the method has been called. Multiple dispatch generalizes the dynamic dispatching to work with a combination of two or more objects.
  • 4. When Several functions having same name in such cases, the name at the function call site is not sufficient for identifying the code to be executed .Here the dispatchment arrises. • single-dispatch OOP languages when invoking a method (“function calling”) one of its arguments is treated specially and used to determine which of the methods of that name is to be called. FOR EG:-special .method (other, arguments, here);
  • 5. • By contrast, in languages with multiple dispatch, the selected method is the one whose arguments match the number and function call type. • There is no "special" argument that "owns" the function/method carried out in a particular call. • Such as Common Lisp Object System (CLOS) is latest example of multiple dispatch.
  • 6. • programming languages that defer data type identification until run-time, • the selection among alternative functions must occur at run-time, based on the dynamically determined types of function arguments. • Functions whose alternative implementations are selected in this manner are referred to most generally as multimethods. • there is some run-time cost associated with dynamically dispatching function call.
  • 7. • the distinction between overloading and multimethods can be blurred, • the compiler determining whether compile-time selection can be applied to a given function call, or whether slower run-time dispatch is needed.
  • 8. • • • • • dynamic dispatch in mostly compilers languages was studied and the results stated that 13%-32% of generic functions utilize the dynamic type of a single argument, while 2.7%-6.5% of them utilize the dynamic type of multiple arguments. remaining 65%-93% of generic functions have a single concrete method (overrider), and therefore are not considered to use the dynamic types of their arguments. In addition, the study reports that 2%-20% of generic functions had two and 3%-6% had three concrete function implementations.
  • 9. • • • • • In the presence of multiple dispatch, the traditional idea of methods as being defined in classes and contained in objects becomes less appealing — each collide-with method there is attached to two different classes, not one. Hence, the special syntax for method invocation generally disappears, so that method invocation looks exactly like ordinary function invocation methods are grouped not in classes but in generic functions. AS IN multiple dispatch, such as Common Lisp, it
  • 10. • In languages that do not support multiple dispatch at the language definition or syntactic level, it is often possible to add multiple dispatch using a library extension. • For example, the module multimethods.py provides CLOS-style multimethods for Python without changing the underlying syntax or keywords of the language. • • Multiple dispatch or multimethods or function overloading is the feature of some object-oriented langages in which a function or method can be dynamically dispatched based on the run time (dynamic) type of more than one of its arguments. This is an extension of single dispatch polymorphism where a method call is dynamically dispatched based on the actual derived type of the object on which the method has been called. Multiple dispatch generalizes the dynamic dispatching to work with a combination of two or more objects.
  • 11. EXAMPLE OF MULTIPLE DISPATCH • • • • • C does not have dynamic dispatch, Often an enum is used to identify the subtype of an object. Dynamic dispatch can be done by looking up this value in a function pointer branch table. EX:-typedef enum { asteroid = 0, spaceship } Thing; C++ is being considered,[3] currently C++ only supports single dispatch natively. The methods of working around this limitation are analogous; either use the visitor pattern, double dispatch, dynamic cast: it can be approximately implemented using double dispatch or a type based lookup table as outlined in the C/C++ JAVA supports only single dispatch and code like visitor pattern helps to solve this problem of its implementatiopn
  • 12. • • • • • • • • • • • • • • PRogramming languages that support general multimethods: Common Lisp (via the Common Lisp Object System) Haskell via Multi-parameter type classes Dylan Nice Cecil R Groovy Perl 6 Seed7 Clojure C# 4.0 Fortress TADS
  • 13. Multimethods in other languages via extensions: • • • • • • • • Scheme (via e.g. TinyCLOS) Python (via PEAK-Rules, RuleDispatch, gnosis.magic.multimethods, or PyMultimethods) Perl (via the module Class::Multimethods) Java (using the extension MultiJava) Ruby (via the library The Multiple Dispatch Library and Multimethod Package and Vlx-Multimethods Package) .NET (via the library MultiMethods.NET) C# (via the library multimethod-sharp) Factor (via the standard multi-methods vocabulary)