Nuru icon indicating copy to clipboard operation
Nuru copied to clipboard

Implement module system for stdlib (msingi) and local libs (hapa)

Open gekkowrld opened this issue 1 year ago • 1 comments

The module system is now nearly complete.

The module system is file based. You can import a file (don't include the extension) File extensions MUST be .nuru. You can nest as deep as possible but the last part MUST always be a file. e.g tumia d1::d2::d3::...::d99::f Aliasing can be used e.g tumia lan::fr = en

The msingi and hapa resolutions are done and can be used. Outside modules have not yet been implemented. This can be bypassed by using vendoring system(s).

To use a module from std, just write

tumia msingi::hisabati

andika("Thamani ya PI ni {0}".panga(hisabati.PI()))

If the module name already exists, you can add = alias to change the name used.

tumia msingi::hisabati = math

andika("The value of PI is {0}".panga(math.PI()))

For the internal modules, then the syntax to be used is tumia hapa::faili

tumia hapa::majina

andika("Jina la pili ni {0}".panga(majina.pili()))

External modules are yet to be supported as of now.

gekkowrld avatar Dec 22 '24 12:12 gekkowrld

i've improved most of the cases. @AvicennaJr you can now review the pr.

gekkowrld avatar Dec 29 '24 18:12 gekkowrld