Creating modules and packages

Modules are used to create new namespaces. In Julia, creating a module is as simple as wrapping your code around a module block, like so:

module X # your codeend

In general, modules are created for the purpose of sharing and reuse, and the best way to achieve this is to organize code in Julia packages. A Julia package is a directory and file structure for maintaining module definitions, test scripts, documentation, and related data.

There is a standard directory structure and convention for Julia packages; however, it would be a hassle to manually configure a new program in the same structure every single time. Fortunately, there are some open source tools that automatically create the structure for a new package. ...

Get Hands-On Design Patterns and Best Practices with Julia now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.