From 05aafd1e91de7ceeff78bada89376cc705d78bd7 Mon Sep 17 00:00:00 2001 From: Caleb-o Date: Sat, 21 Sep 2024 22:19:07 +1000 Subject: [PATCH] Update wording on modules page --- src/basics/modules.md | 14 +++++++------- src/basics/the_basics.md | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/basics/modules.md b/src/basics/modules.md index e8cde98..c692379 100644 --- a/src/basics/modules.md +++ b/src/basics/modules.md @@ -1,8 +1,6 @@ # Modules -> 🚧 Work in progress 🚧 - -[Modules](https://c3-lang.org/references/docs/modules/) in C3 are quite interesting. Every file must start with a module declaration, as such `module mymodule`. A module is a container that namespaces our code. Later on, I will show how modules are our gateway into using generics. +[Modules](https://c3-lang.org/references/docs/modules/) in C3 are quite interesting. Every file must start with a module declaration, as such `module mymodule`. A module is a container that namespaces our code. Later on, I will show how modules are our gateway into using generics. This is not full coverage on modules, but a glimpse to understand how to use them. Here's a list of things that will be covered: - [Using modules and its properties](#using-modules) @@ -51,13 +49,13 @@ In C3, generics are expressed through modules. This is different to other langua {{#include ../../examples/basics/modules_generic.c3::5}} ``` -Since we use the module, how does that look when importing? +Notice the `()` syntax. This is also used when passing the generic parameter(s). Since we declare generics on the module, how does that look when importing? ```c++ {{#include ../../examples/basics/modules_generic_use.c3::1}} ``` -This is just importing as normal? So how do we use the generic? We can use our `Foo` like this: +This is just importing as normal? So how do we use the generic? We can use our `Foo` type that we declared like this: ```c++ {{#include ../../examples/basics/modules_generic_use.c3::8}} @@ -69,7 +67,9 @@ We can extend our generic module to include a function, that takes the generic v {{#include ../../examples/basics/modules_generic.c3}} ``` -Using this function is quite similar: +Then use the generic function we made like so: ```c++ {{#include ../../examples/basics/modules_generic_use.c3:10:}} -``` \ No newline at end of file +``` + +More on generics, how generic modules work and constraints can be found in the [guide](https://c3-lang.org/references/docs/generics/). \ No newline at end of file diff --git a/src/basics/the_basics.md b/src/basics/the_basics.md index 3bcf27f..8d0fd7f 100644 --- a/src/basics/the_basics.md +++ b/src/basics/the_basics.md @@ -1,6 +1,6 @@ # The Basics -These examples are meant to get you started with C3, however, these will not be too in-depth around the whole language. For more detailed explanations of the language itself, you can visit [the official guide](https://c3-lang.org/guide/). This will cover only a few topics to help understand C3, but will not describe everything. +These examples are meant to get you started with C3, however, these will not be too in-depth around the whole language. For more detailed explanations of the language itself, you can visit [the official guide](https://c3-lang.org/guide/). This book will only cover a few topics to help understand C3, but will not describe everything. - [Hello World](hello_world.md): first program with details around its structure -- [Modules (WIP 🚧)](modules.md): small examples of how C3 uses modules \ No newline at end of file +- [Modules](modules.md): small examples of how C3 uses modules \ No newline at end of file