Chapter 2

How do we create a new namespace?

A namespace is created using a module block. Typically, a module is defined as part of a Julia package.

How do we expose the functions of a module to the outside world?

Functions and other objects defined within a module can be exposed using an export statement.

How do we reference the proper function when the same function name is exported from different packages?

We can just prefix the function name with the package name. As an alternative, we can use a using statement for one package, and an import statement for the other, so that we can use the function name directly for the first package but use the prefix syntax for the other.

When do we separate code into multiple modules?

It is time to consider separating code into modules when the code becomes too big and too difficult to manage. We expect some refactoring to ensure the proper level of coupling between modules.

Why is semantic versioning important in managing package dependencies?

Semantic versioning defines a clear contract about when a breaking change is introduced in a new version. When used properly and consistently, it helps programmers to determine whether the change is compatible with the existing software and whether additional testing is required.

How is defining functional behavior for abstract types useful?

It is useful to define functional behavior for abstract types because the same behavior can be applied for the respective subtypes.

When should we make a type mutable?

It is appropriate to make a type mutable when some parts of the data type are expected to be changed. It is also useful when memory allocation needs to be reduced for performance reasons.

How are parametric types useful?

Parametric types allow a concrete type to be defined without hardcoding the type of its fields, so the same type can be used to generate new variations for different purposes.

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

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