chapter three

3 Julia's support for scaling projects

 

This chapter covers

  • Julia's type system
  • Defining multiple methods for a function
  • Working with modules and packages
  • Using macros

In this chapter you will learn elements of the Julia language that are important when creating larger projects. We start with exploring Julia's type system. Understanding how type hierarchy works is essential to learning how to define multiple methods for a single function, a topic we have started discussing in section 2.4. Similarly, when you use some existing function must know how to find out what types of arguments it accepts. Getting an exception because you tried to pass an argument of incorrect type when calling a function is one of the most common errors when working in Julia. To avoid such problems, you must have a good understanding of how Julia's type system is designed.

When you define methods for a function you can restrict the types of arguments they accept. This feature makes your Julia programs faster, allows you to catch bugs more easily, and makes it easier to understand how the code works.

If your projects grow larger you will need to use third-party functionalities provided as packages or organize your source code into modules. In this chapter you will learn how you can do it with Julia.

3.1 Understanding Julia's type system

3.2 Multiple dispatch in Julia

3.3 Working with packages and modules

3.4 Using macros

3.5 Summary