Module¶
Warning
This document is currently a draft, it means it will change anytime.
Importing code from other files¶
Suppose the following file structure:
1 2 3 | - myFoler - math.pine - app.pine |
1 2 3 4 5 6 | // File math.pine def (this Number).square -> Number pass def (this Number).inverse -> Number pass |
1 2 3 4 5 | // File app.pine import "./math.pine" def .main let x = 2.square |
Every function defined in math.pine
is now exposed in app.pine
.
Importing code from Github¶
You must specify the version.
1 | import "github.com/wongjiahau/yaml/v2.0.0" |
Default encapsulation¶
By default, the imported modules of an imported module will not be exposed to the importer.
Consider the following scenario
1 2 | // Filename: math.pine def |
Note
If A imported B, and B imported C, the declarations from C will not be exposed in A.