From 2ce7109b30181183c560e0a17549d54ce094491f Mon Sep 17 00:00:00 2001 From: Adam Oates <31167933+islonely@users.noreply.github.com> Date: Mon, 21 Aug 2023 02:45:37 -0500 Subject: [PATCH] docs: add undocumented behavior (#19177) --- doc/docs.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/docs.md b/doc/docs.md index 732e35ace7..62ede486fe 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -3150,6 +3150,17 @@ pub fn say_hi() { println('hello from mymodule!') } ``` +All items inside a module can be used between the files of a module regardless of whether or +not they are prefaced with the `pub` keyword. +```v failcompile +// myfile2.v +module mymodule + +pub fn say_hi_and_bye() { + say_hi() // from myfile.v + println('goodbye from mymodule') +} +``` You can now use `mymodule` in your code: @@ -3158,6 +3169,7 @@ import mymodule fn main() { mymodule.say_hi() + mymodule.say_hi_and_bye() } ``` @@ -3453,7 +3465,9 @@ fn fn1(s Foo) { #### Casting an interface -We can test the underlying type of an interface using dynamic cast operators: +We can test the underlying type of an interface using dynamic cast operators. +> **Note** +> Dynamic cast converts variable `s` into a pointer inside the `if` statemnts in this example: ```v oksyntax // interface-example.3 (continued from interface-example.1)