Skip to content

Commit

Permalink
uses convention
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrik-bakke committed Oct 23, 2023
1 parent abbdde1 commit b4edfd9
Showing 1 changed file with 46 additions and 5 deletions.
51 changes: 46 additions & 5 deletions src/STYLEGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ later.

## Other code conventions

- We employ an 80-character line length limit. This means that lines of code
generally should not be longer than 80 characters. If they exceed this limit,
they should be reformatted to fit within the limit by inserting appropriate
line breaks.

!!! info

Names can be longer than the line character limit.

- We place binary operators/separators at the beginning of a line rather than
the end. When they are a single character wide, this aligns very well with our
parenthization and indentation rules. Consider for instance the following
Expand Down Expand Up @@ -178,12 +187,44 @@ later.
( another-term-of-that-type))
```

- We employ an 80-character line length limit. This means that lines of code
generally should not be longer than 80 characters. If they exceed this limit,
they should be reformatted to fit within the limit by inserting appropriate
line breaks. We do make some exceptions to this rule:
- The `uses`-keyword and the accompanying list of variables is placed on their
own lines.

- Names can be longer than the line character limit
In the base case, write

```rzk
#define my-name
uses (my-variable-1 my-variable-2 ...)
( A : U)
...
```

If the variable list (`(my-variable-1 my-variable-2 ...)`) does not fit on the
first line together with `uses`, insert a line break directly after `uses` and
write:

```rzk
#define my-name
uses
( my-variable-1 my-variable-2 ...)
( A : U)
...
```

If the list still does not fit on a single line, start insert line breaks
between variables. Here, there is some room for common sense in where the line
breaks should be inserted, allowing for certain variable names to be grouped
together:

```rzk
#define my-name
uses
( my-variable-1
my-variable-2
...)
( A : U)
...
```

## Naming conventions

Expand Down

0 comments on commit b4edfd9

Please sign in to comment.