Language Guide
Modules
import and export in GSET are parsed but not yet emitted.
Planned
GSET recognizes import and export statements at the syntax level:
import "math"
export Pi = 3.14159
export add(a, b) {
return a + b
}Current behavior
- Import. The statement parses, but no
importdirective is emitted in any target output. It is effectively a no-op today. - Export. Parsed as a marker for top-level exports; the exported functions/constants are still emitted as plain top-level declarations, without an export keyword.
Concretely, import "math" at the top of a file is accepted and ignored; you must rely on the target's builtins (e.g. Math.pow for JavaScript's **) without GSET-level imports.
What we're building
- Emit per-target imports:
importfor Python/JS/Java,requirefor Ruby,import+ package layout for Go exportwrappers (module.exports,export, Go exported identifiers)- A file-header
key=valuekeyword block (parsed byconfig/config.gobut not yet applied)
Recommendation today
Keep programs single-file and self-contained. If you need a module boundary, structure the code as one file per target output with -o:
gset transpile lib.gset --target js -o lib.js
gset transpile app.gset --target js -o app.jsand stitch includes with your target's own tooling (e.g. <script src>).