-
Couldn't load subscription status.
- Fork 2k
Closed
Labels
A:modulesIssues related to functionality of the module system. See also usage:modulesIssues related to functionality of the module system. See also usage:modulesA:scoping/name-resolutionHow Nu finds which variables/functions are in scope and to what they are boundHow Nu finds which variables/functions are in scope and to what they are bounddeprecated:questionQuestions should be redirected to GitHub discussionsQuestions should be redirected to GitHub discussions
Description
Question
Let say i have two modules
# modules/moduleA.nu
export def hello [--period: duration] { sleep $period; echo "hello from moduleB" }# modules/moduleB.nu
use moduleA.nu *
export def sleep [] { echo "hello from moduleA" }And a global config.nu file
# config.nu
const nushellDir = ($nu.config-path | path parse).parent
const modules = ([$nushellDir, modules] | path join)
use $modules *This results in a similar error:
× Extra positional argument.
╭─[modules/moduleA.nu:1]
1 │ sleep $period
· ───┬───
· ╰── extra positional argument
Apparently all modules are loaded in the same space, as some sort of lookbehind occurs for modules and it overrides built-ins with custom commands.
Am I doing something incorrectly here? What I initially assumed is that if I import one module into another the target of the import should not affect the logic of the imported module.
Note
I'm quite unexperienced with nushell behavior as a programming language so sorry if all of this is nonsense
Additional context and details
- OS: Windows
- Nushell Version: 0.102.0
Metadata
Metadata
Assignees
Labels
A:modulesIssues related to functionality of the module system. See also usage:modulesIssues related to functionality of the module system. See also usage:modulesA:scoping/name-resolutionHow Nu finds which variables/functions are in scope and to what they are boundHow Nu finds which variables/functions are in scope and to what they are bounddeprecated:questionQuestions should be redirected to GitHub discussionsQuestions should be redirected to GitHub discussions