Book Image

Getting Started with Julia

By : Ivo Balbaert
Book Image

Getting Started with Julia

By: Ivo Balbaert

Overview of this book

Table of Contents (19 chapters)
Getting Started with Julia
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The Rationale for Julia
Index

Chapter 6. More on Types, Methods, and Modules

Julia has a rich built-in type system, and most data types can be parameterized, such as Array{Float64, 2} or Dict{Symbol, Float64}. Typing a variable (or more exactly the value it is bound to) is optional, but indicating the type of some variables, although it is not statically checked, can gain some of the advantages of static type systems as in C++, Java, or C#. A Julia program can run without any indication of types, which can be useful in a prototyping stage, and it will still run fast. However, some type indications can increase the performance by allowing more specialized multiple dispatch. Moreover, typing function parameters makes the code easier to read and understand. The robustness of the program is also enhanced by throwing exceptions in cases where certain type operations are not allowed. These failures will manifest during testing, or the code can provide an exception handling mechanism.

All functions in Julia are inherently generic...