ballercat / walt

:zap: Walt is a JavaScript-like syntax for WebAssembly text format :zap:

Home Page:https://ballercat.github.io/walt/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import suggestion

opened this issue · comments

Feature Request

Overview

Right now from what I've learnt, you can only import symbols from other walt files and none of the symbols not imported from target walt file will be present in output wasm module.
Also I found no way to just import a walt file without giving it a symbol to import, like import "./base.walt";

Impact

Large, because it requires the compiler to include all code from imported module in output wasm module if necessary.

Details

Currently I'm looking for a clean and easy to use language that mainly targets wasm. I found walt and assembly script the most promising. But there's a serious issue with walt that I can't expand my script to other walt scripts for making a simple standard library or defining some default values without explicitly importing their name in my main script. For example I can't define a memory, table or type in another script and import the script with something like import "./std.walt"; and let the compiler automatically import everything from that script.

Also the compiled result of importing a script like import { a: i32 } from "./script.walt"; is (import "./script.walt" "a" (global $./std.walt.a i32)) which causes an error in the runtime I'm using because it cannot find "./script.walt"! I suggest to import the scripts statically (by putting everything from the imported script inside the main script or wherever it's imported from)