mirror of
https://github.com/fluencelabs/aqua-book
synced 2024-12-04 15:20:19 +00:00
GitBook: [master] one page modified
This commit is contained in:
parent
87fcb14711
commit
41915e6601
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user