Modules
Modular, like the 80s
Modules are important because they allow us to store and structure code as folders in the filesystem. They are mostly useful fo sparating different implementations of data and functions. SMLL moduls are inspired by Java Packages. They are just nested folders.
import System::Io
Some where there is a modules path which the standard library is located. Inside that modules directory there is a directory named System with the Io file.
<ROOTDIR>
└─ System
└─── Io.sml
└─── Result.sml
└─── Io
└─── StdIo.sml
Importing modules simply works like this.
import System::Io::Stdio
import System::Io
import System::Result
These simply translate to the following.
imports System/Io/Stdio.sml
imports System/Io.sml
imports System/Result.sml
Last updated