ballercat / walt

:zap: Walt is a JavaScript-like syntax for WebAssembly text format :zap:
https://ballercat.github.io/walt/
MIT License
4.64k stars 122 forks source link

export default #162

Open rjoydip-zz opened 6 years ago

rjoydip-zz commented 6 years ago

Feature Request

Great work :+1:

Overview

It would be nice to export default functions.

Example:

export function decrement(): i32 {}
export function increment(): i32 {}

export default {
    decrement,
    increment,
};
ballercat commented 6 years ago

Thanks!

Could you talk more about how you would like to use the default export above? Since in JS this module would look something like this already:

// WebAssembly module result
const mod = {
   instance: {
      exports: {
         decrement: fn(),
         increment: fn()
      }
   }
}

So I'm a bit fuzzy on what the utility added by default here.

We could use default for the Module Start Function. Right now that is done by simply naming a function start so using a default keyword might be nicer.

rjoydip-zz commented 6 years ago

I haven't anything in my mind but I am just wondering something like export default function or like es6

export default function count () {}