Summary

In this chapter, we started our journey by discussing how to define functions and make use of various types of function arguments, such as positional arguments, keyword arguments, and variable arguments. We talked about how to use splatting to auto assign the elements of an array or tuple to function arguments. We explored first-class functions by assigning them to variables and passing them around in functional calls. We learned how to create anonymous functions and use the do-syntax to make code more readable.

We then discussed Julia's dispatch mechanism and introduced the concept of multiple dispatch. We realized that ambiguity may exist and so we reviewed the standard tools for detecting ambiguities. We have learned how dispatch is dynamic in nature. We looked at  parametric methods and how they could be useful in several use cases, such as enforcing type consistency and extracting type information from the type parameters. 

We learned how to design interfaces. We realized that there is no formal language syntax for defining interfaces in Julia, but we also recognize defining interfaces is straightforward and easy to do. We came to know that sometimes it is acceptable to have soft contracts so that the developer does not have to implement all interface functions. Finally, we wrapped up the discussion with the concept of traits and how they can be useful for querying whether a data type implements a specific interface.

In the next chapter, we will discuss two more major features in the Julia language—macros and meta programming. Macros are very useful in creating new syntax that makes the code clean and easy to maintain. Just take a deep breath and keep going!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.161.132