Commit 022eddf
Fix incorrect claim that a module file cannot match its directory name (#2219)
The 'Creating Modules' chapter stated that a `.nu` file cannot have the
same name as its module directory (e.g. `spam/spam.nu`). Nushell accepts
that layout: the file imports normally, both directly (`use spam/spam.nu`)
and as a submodule exported from `spam/mod.nu`.
The restriction that does exist is on the exported *name*: a module cannot
export a command, alias, or known external defined inside it, or a submodule
declared by name, with the same name as the module itself.
Replace the false statement with the real restriction, and keep a note
warning that a same-named submodule is still worth avoiding because its
`main` is shadowed by the parent module's `main`.
Co-authored-by: David Pavlovschii <guyraya9@gmail.com>1 parent 7a4ab02 commit 022eddf
1 file changed
Lines changed: 15 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
428 | | - | |
| 428 | + | |
429 | 429 | | |
430 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
431 | 444 | | |
432 | 445 | | |
433 | 446 | | |
| |||
0 commit comments