Skip to content

Commit

Permalink
Merge pull request #85 from invenia/ox/modules
Browse files Browse the repository at this point in the history
Add about indenting modules
  • Loading branch information
oxinabox authored Mar 31, 2021
2 parents c6c6bc7 + bc4bc7e commit 2f13365
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ When convention guidelines conflict this guide takes precedence (known conflicts
- [Numbers](#numbers)
- [Ternary Operator](#ternary-operator)
- [For loops](#for-loops)
- [Modules](#modules)
- [Type annotation](#type-annotation)
- [Package version specifications](#package-version-specifications)
- [Comments](#comments)
Expand Down Expand Up @@ -845,6 +846,15 @@ end
[foo(x) for x ∈ xs]
```

### Modules

Normally a file that includes the definition of a module, should not include any other code that runs outside that module.
i.e. the module should be declared at the top of the file with the `module` keyword and `end` at the bottom of the file.
No other code before, or after (except for module docstring before).
In this case the code with in the module block should **not** be indented.

Sometimes, e.g. for tests, or for namespacing a enumeration, it *is* desirable to declare a submodule midway through a file.
In this case the code within the submodule **should** be indented.

### Type annotation

Expand Down

0 comments on commit 2f13365

Please sign in to comment.