-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththinkpad.txt
36 lines (27 loc) · 1.51 KB
/
thinkpad.txt
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
--------------------------------------------------------------------------------
How do I want to handle modules and imports?
- Local modules are imported with a relative path.
- Installed Modules (from package manager) are imported with a package name.
- Modules Contain public and private functions. (public functions are exported with the keyword export)
- Example: export function publicFunction() { ... }
- Example: function privateFunction() { ... }
(IDEA)
- Can import a function from a module with the keyword include.
- Example: include { publicFunction } = './module.dem'
- Example: include { publicFunction } = 'module'
- Imports are hoisted to the top of the file.
- Imports are evaluated before the rest of the file.
(IDEA)
- Imports are cached. (If a module is imported twice, it will only be evaluated once.)
(IDEA)
- Imports can be aliased.
- Example: include { publicFunction as alias } = './module.dem'
(IDEA)
Do we have GLOBALS & LOCALS (To be implemented if so)
- Globals can be seen by all programs no matter what
- Locals can be seen by 1 program by defining or importing
- Local scope = program file
- Global scope = all programs
- Globals also import default imports (eg, stdio, stdlib, math, time)
- Exports are added to an array of Demi variables which can be appended onto the programs locals after importing
--------------------------------------------------------------------------------