What predefined data type can be used to conveniently create new singleton types?
The built-in Val type can be used to create new singleton types easily. The Val constructor function can accept any bits-type value and return a singleton of type Val{X}, where X is the value being passed to the constructor function.
What are the benefits of using singleton type dispatch?
Using singleton type dispatch, we can eliminate conditional statements that depend on the data type. It also allows us to add new functionalities by just defining new functions, without having to modify an existing function. Because Julia does the dispatch natively, there is no need to create any custom function just for dispatch.
Why do we want to create stubs?
Stubs are very useful indeed in automated testing. First, if a function requires connecting to a remote web service, then it can...