January 2020
Intermediate to advanced
532 pages
13h 31m
English
Suppose that we are developing a file loading facility that supports lazy loading. By lazy, we are talking about not loading a file until the content is required. Let's take a look at the following code:
mutable struct FileContent path loaded contentsend
The FileContent struct contains three fields:
Here's the constructor for the same struct:
function FileContent(path) ss = lstat(path) return FileContent(path, false, zeros(UInt8, ss.size))end
As with our current design, we pre-allocate memory for the file but we do not read the file ...
Read now
Unlock full access