From b795ce9f45f1344f37f3bdcb46210e8c51cb95b4 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Fri, 18 Sep 2020 11:52:23 +0800 Subject: [PATCH] Refine docs. --- doc/src/rust/packages/index.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/src/rust/packages/index.md b/doc/src/rust/packages/index.md index ee0daa37..a5df94cd 100644 --- a/doc/src/rust/packages/index.md +++ b/doc/src/rust/packages/index.md @@ -29,7 +29,7 @@ engine.load_package(package.get()); // load the package manually. 'get' returns Difference Between a Package and a Module ---------------------------------------- -Packages are actually implemented as [modules], so they share a lot of behavior and characteristics. +Packages are internally implemented as [modules], so they share a lot of behavior and characteristics. The main difference is that a package loads under the _global_ namespace, while a module loads under its own namespace alias specified in an [`import`] statement (see also [modules]). @@ -37,6 +37,11 @@ namespace alias specified in an [`import`] statement (see also [modules]). A package is _static_ (i.e. pre-loaded into an [`Engine`]), while a module is _dynamic_ (i.e. loaded with the `import` statement). +Functions in a package are _flattened_, meaning that functions from sub-modules must be pulled up to the root level. +In other words, there can be no sub-modules in a package, and everything should reside in one, flat namespace. + +Only functions matter for a package. Constant variables registered in a package are ignored. + Load a Module as a Package --------------------------