From 7526472a6ed56db11ec141ca4898de467b62696b Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Mon, 19 Oct 2020 05:14:43 -0700 Subject: [PATCH] add a section on naming new stdlib module names (#15590) --- doc/contributing.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/contributing.rst b/doc/contributing.rst index a4baaef054..9c567cb0ba 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -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.