WebAssembly / design

WebAssembly Design Documents
http://webassembly.org
Apache License 2.0
11.4k stars 696 forks source link

Namespaces #1468

Open SoniEx2 opened 1 year ago

SoniEx2 commented 1 year ago

wasm currently has modules. it'd be nice to see fully-featured namespaces as well.

what are namespaces? to put it simply, it's the ability to use arrays of strings as names.

instead of a function being named "foo_bar", it can be named ["foo", "bar"].

that's it, that's the whole feature request.

penzn commented 1 year ago

Withing a module functions are addressed by an index, not a symbolic name. On the other hand, exports and imports use symbolic names. Imported names consist of two strings, which allows them to be used in a manner similar to namespaces. Are you proposing to extend that further or introduce grouping inside of modules as well?

SoniEx2 commented 1 year ago

exports use simple names, since the module name is controlled outside of the module. the proposal is to use arrays of strings for export names, which implies using arrays of strings for import names.