diff --git a/site/src/tutorial.rs b/site/src/tutorial.rs index 5d183cf6b..aadcf760c 100644 --- a/site/src/tutorial.rs +++ b/site/src/tutorial.rs @@ -1683,10 +1683,20 @@ fn TutorialModules() -> impl IntoView { view! {
"Modules are a way to organize your code in Uiua. Any Uiua file can be used as a module."
- -"Using modules involves loading files from the file system."
+"Modules are a way to organize your code in Uiua. They can either be defined in a scope, or imported from a file. Any Uiua file can be used as a module."
+"Modules can be compared to namespaces in other languages."
+ +"Scoped modules are defined between a pair of ""---"
"s. The first ""---"
" should be immediately followed by a name for the module. Module names follow the same rules as other bindings."
"Bindings defined inside a scoped module are only visible inside the module."
+"Names from inside the module can be referenced by following the module name with a ""~"
"."
"Names defined above the module can be referenced inside it."
+"Using files as modules involves loading files from the file system."
"This website has a virtual file system. You can write to virtual files with "
"There is also a test module that can always be imported as ""example.ua"
". Its contents is:"
"Modules can be imported from Git repositories. Instead of a path, use a URL prefixed with ""git:"
"."
"The Uiua GitHub organization hosts an example module at ""https://github.com/uiua-lang/example-module"". The protocol specification can be omitted."
"On the site, code is pulled from a ""lib.ua"
" file at the root of the repository. Loading other files is not supported."
"To use Git modules in the ""native interpreter"", you must have Git installed. The repository is added as a Git submodule and the ""lib.ua"
" file is loaded as the module's contents."
"The native interpreter also supports adding an additional ""branch:
" specifier after the URL."
"On the site, code is pulled from a ""lib.ua"
" file at the root of the repository. Loading other files on the site is not supported."
"To use Git modules in the ""native interpreter"", you must have Git installed. The repository is added as a Git submodule and the ""lib.ua"
" file is loaded as the module's contents. Code from other files can be made available by importing them as modules in the ""lib.ua"
" file."
"The native interpreter also supports adding an additional ""branch:
" or ""commit:
" specifier after the URL."
"You can find a curated list of Uiua modules ""here""."
} } @@ -1740,20 +1750,20 @@ fn TutorialTesting() -> impl IntoView {"Test scopes are regions of code that are delimited with ""---"
"s at the top level of a file. They are meant to be used with "
"A ""scoped module"" with the name ""test"
" is special in that is only run when the code is run with ""uiua test"
". It is meant to be used with "
"1"
"."
"The first argument to "
"One nice pattern for writing tests is to put the expected result before the test computation and use "
"If the result does not match the expectation, that incorrect result will be thrown."
-"Whether tests will run or not depends on how you run the code."