Open stefnotch opened 3 weeks ago
Some ideas for namespaces summarized in this module system discussion doc. Notably:
Code in files and libraries are addressable in a 'module hierarchy'. File and directory names names in applications map automatically into the module hierarchy. Future features like namespace
would also be placed into the module hierarchy.
If zip.wgsl
has a future namespace construct like namespace dig { fn bar() {} }
, the namespace would map into the same addressable hierarchy.
import super::util::zip::dig::bar;
Allow grafting subtrees into the module hierarchy from WESL.
For example,
let's say the file system contains other/bar/zig.wesl
and other/bar/zag.wesl
. We've discussed namespace
variations that place a namespace in the module hierarchy. We might put a statement like this in util/stuff.wesl
:
namespace foo = package::other::bar;
Then you could write:
import package::util::stuff::foo::zig
Maybe one of us should be brave enough to write up a WebGPU proposal for namespaces. One that lets us cleanly say "a WESL module creates a WGSL namespace".
We'd need
fully.qualified.syntax()