Skip to content

Commit

Permalink
Update wording on modules page
Browse files Browse the repository at this point in the history
  • Loading branch information
Caleb-o committed Sep 21, 2024
1 parent afb6c8a commit 05aafd1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/basics/modules.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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 `(<Type>)` 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}}
Expand All @@ -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:}}
```
```
More on generics, how generic modules work and constraints can be found in the [guide](https://c3-lang.org/references/docs/generics/).
4 changes: 2 additions & 2 deletions src/basics/the_basics.md
Original file line number Diff line number Diff line change
@@ -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
- [Modules](modules.md): small examples of how C3 uses modules

0 comments on commit 05aafd1

Please sign in to comment.