add a section on naming new stdlib module names (#15590)

This commit is contained in:
Timothee Cour
2020-10-19 05:14:43 -07:00
committed by GitHub
parent 04f8fcfbd0
commit 7526472a6e

View File

@@ -555,3 +555,17 @@ to existing modules is acceptable. For two reasons:
Newly introduced issues have to be balanced against motivating new people. We know where
to find perfectly designed pieces of software that have no bugs -- these are the systems
that nobody uses.
Conventions
-----------
1. New stdlib modules should go under `Nim/lib/std/`. The rationale is to require
users to import via `import std/foo` instead of `import foo`, which would cause
potential conflicts with nimble packages. Note that this still applies for new modules
in existing logical directories, eg:
use `lib/std/collections/foo.nim`, not `lib/pure/collections/foo.nim`.
2. New module names should prefer plural form whenever possible, eg:
`std/sums.nim` instead of `std/sum.nim`. In particular, this reduces chances of conflicts
between module name and the symbols it defines. Furthermore, is should use `snake_case`
and not use capital letters, which cause issues when going from an OS without case
sensitivity to an OS without it.