-
Notifications
You must be signed in to change notification settings - Fork 531
Open
Description
I can't find any documentation for nested modules and calling parent module functions within a child module.
There seems to be no way to call the outermost parent module's baz
function from within a child module. It will always prefer the next parent's baz
function.
It is impossible to make the following code print baz in foo1
. In my use case the function baz
is actually called path
, so it not only overwrites the second definition of path
in foo1
but also makes the global nushell path
module unusable within the bim()
function in foo3
.
Example code:
export module foo1 {
export def baz [] { print "baz foo1" }
export module foo2 {
export def baz [] { print "baz in foo2" }
export module foo3 {
export def bim [] {
print "bim in foo3"
# this will succeed and call "baz in foo2"
baz
# this will fail with `external foo1 not found`
# foo1 foo2 baz
# this will also fail with `external foo1 not found`
# foo1 baz
}
}
}
}
use foo1
foo1 foo2 foo3 bim # this will print "baz in foo2"
Metadata
Metadata
Assignees
Labels
No labels