-
Notifications
You must be signed in to change notification settings - Fork 0
Modules
Joakim edited this page Dec 17, 2021
·
17 revisions
A module's last evaluated expression is implicitly exported. By convention, an object.
sum: (a, b) -> a + b
diff: (a, b) -> a - b
[sum, diff]
import module: 'module.ks'
import [foo]: 'module.ks'
import [foo as alias]: 'module.ks'
import [foo, bar]: 'module.ks'
import _: 'module.ks' -- for side effects
The import
declaration can also import individual items from the global
object.
import JSON
import Math
import Promise
Or only specific fields from those.
import [abs, ceil]: Math
This programming language only exists as a design. I'm unlikely to ever get the chance to write a compiler for it.
Feel free to steal any parts of it that you like. Ideas are better stolen than forgotten. (They're not my ideas anyway.)