summaryrefslogtreecommitdiff
path: root/docs/type_system/namespace.md
blob: d3a43db012ffa42a8dc017c2ab62c5c243920eb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Namespace

---

```text
Namespace[[NATIVE | MODULE | MAIN] NAMESPACE_POINTER]
```

## Type Body Object Definitions

```c
typedef struct {
    union {
        kpl_namespace_native *native;
        kpl_namespace_module *module;
    } namespace;
} kpl_type_body_namespace;
```

## Exports

### \`export

#### Type must be Fn[STATELESS], Overload, Const, Shared or Namespace to export

#### Re-exporting

## Imports

### \`import

```text
namespace : `import Value[String]
```

All imports are relative to the importer

### \`use

```text
namespace : `use Value[String]
```

## Namespace destructuring

```text
namespace : `use Value[String]
namespace[scope_name.namespace_name]
namespcae[name] // resolves to namespace[name.name]
`use Value[String] [name]
```

## Main

### \`is_main

Run this function if the module is not imported