What are the actual sending jobs? I made them round and all are unclear. They just start closing inside nested blocks / other tasks? Speaking from a scalve / lift point .. But I think it's universal, I've mentioned them in Ruby as well.
The goal of the transmission is to dynamically decide what to do in your function.
When you have a dynamic transmission function, it is main (or only if you do not need to cast or other conversion) to decide which other functions call. Decision is often based on the method, or the example of some type of parameters, but it may also depend on the basis of the parameter (or) at the value of, or some configured value
sending The rule can be harsh (such as using pattern mailing in Scala), or from the dispatch table.
As you have mentioned, there are several types of changes, such as a single dispatch (the solid method depends on the example that the original method is called, which is an original OO mechanism), double Dispatch (The function calls for different concrete dischaches calls based on runtime type of multiple objects included in the call)
A related design pattern is a visitor, which allows you to dynamically for existing classes Allows to add a set of keys and which also has a dynamic transmission on its core.
Nested block / closer appears when you define a solid method inside the dispatch method, or define some initial code (EF for the dispatch table).
A simple example for the time of despatch is based on the value of the parameter, string = "hello joe" deaf hello other (): string = "hello joe" deaf hello jon (): string = " Hello john "deaf hello joe (): string =" hello joe "" hello "say define hello (msg: string): string = msg match {case" John "=> Hello John () Case "Joe" => Hello Jo () Case _ = & gt; Hello Other ()} Val FS = Map ("John" -> Hello John _, "Joe" -> Hello!) Def say Halo Dispatchable (msg: string): String = FSJet match {Case} (F) = & gt; F () Case _ = & gt; Hello other ()}}
Comments
Post a Comment