Hacker News new | ask | show | jobs
by xigoi 9 days ago
What do you mean? When you import a module in Janet, it adds a namespace prefix to all symbols. What more do you want?
2 comments

It 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.)
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

Namespaces as first class objects. Janet namespaces symbols by renaming them. It's not the same thing.
The `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.