Update 'Style Guide'

Sasha Koshka 2022-09-01 20:35:33 +00:00
parent eb3058c005
commit 9a3b54ea00
1 changed files with 24 additions and 1 deletions

@ -158,4 +158,27 @@ const (
All enum values the ARF compiler are prefixed with the name of the enum they belong to, as shown above.
The `iota` keyword just initializes everything in the block with incrementing values.
The `iota` keyword just initializes everything in the block with incrementing values.
# Naming Things
Choose descriptive, even lengthy names for things, but don't go absolutely crazy. Use full words, and separate them using camel case. Never, ever use single letter variables (yes, including `i`). For example, say you wanted to name a struct that stored a database of cached parsing results:
These are overly terse and do not convey meaning well. Imagine trying to decipher the meaning of these among a sea of symbols and other names.
```
Cache
PCache
PCacheDB
```
This is excessive. Imagine writing a method for this!
```
DatabaseOfCachedParsingOperationResults
```
This is perfect.
```
ParsingResultCache
```
Note: it can be easier to have somewhat longer names for variables, functions, and members, and somewhat shorter names for types.