4 ms·
Damn it, Janet. No proper namespaces. Hard pass.
by bjourne 5mo ago
Damn it, Janet. No proper namespaces. Hard pass.
- xigoi 5mo agoWhat do you mean? When you import a module in Janet, it adds a namespace prefix to all symbols. What more do you want?
- veqq 5mo agoIt would be really cool to declare multiple modules in the same file, somehow. Also, the Janet community's generally against the word namespace, saying we don't have them. (I don't fully grok why not.)
- ianthehenry 4mo agohttps://github.com/ianthehenry/janet-module/blob/master/init.janet https://github.com/ianthehenry/janet-module/blob/master/init... This is a very very barebones version of this, but it’s not too hard to construct environment tables dynamically
- bjourne 5mo agoNamespaces as first class objects. Janet namespaces symbols by renaming them. It's not the same thing.
- ianthehenry 4mo agoThe `import` macro extends the current environment with prefixed symbols from another environment. But the environment is a first-class object that you can hold and manipulate and use in arbitrary ways — `require` is the lower level primitive that `import` is built on.