GitBook: [master] one page modified

This commit is contained in:
Dmitry Kurinskiy 2021-06-28 12:22:13 +00:00 committed by gitbook-bot
parent 87fcb14711
commit 41915e6601
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF

View File

@ -1,10 +1,27 @@
# Imports & exports
How imports are organized and works internally
Aqua source file has head and body. The body contains function definitions, services, types, constants. Header manages what is imported from other files, and what is exported from this one.
How to export functions and types from a file
### Import expression
The main way to import a file is via `import` expression:
```text
import "@fluencelabs/aqua-lib/builtin.aqua"
func foo():
Op.noop()
```
Aqua compiler takes a source directory and a list of import directories \(usually with `node_modules` as a default\). You can use relative paths to `.aqua` files, relatively to the current file's path, and to import folders.
Everything defined in the file is imported into the current namespace.
### `Use` expression
Use expression makes it possible to import a subset of a file, or to alias the imports to avoid collisions.
{% embed url="https://github.com/fluencelabs/aqua/issues/30" %}
Relationships between exports and abilities
Advanced topic: definition of the imports & exports problem & how Aqua Linker solves it.