Anonymous user
Naming conventions: Difference between revisions
→{{header|Nim}}
Alextretyak (talk | contribs) (Added 11l) |
|||
Line 919:
Convention is that user variables and function names also also cammel case except they start with a lower case. eg myFunctionName. There is no limit to the number of characters in a user symbol, symbols can contain digits and non-ascii characters.
=={{header|Nim}}==
Nim has precise guidelines for naming. Here is an extract of the style guide.
:- Type identifiers should be in PascalCase. All other identifiers should be in camelCase with the exception of constants which may use PascalCase but are not required to.
<lang Nim># Constants can start with either a lower case or upper case letter.
const aConstant = 42
const FooBar = 4.2
var aVariable = "Meep" # Variables must start with a lowercase letter.
# Types must start with an uppercase letter.
type
FooBar = object</lang>
:- When naming types that come in value, pointer, and reference varieties, use a regular name for the variety that is to be used the most, and add a "Obj", "Ref", or "Ptr" suffix for the other varieties. If there is no single variety that will be used the most, add the suffixes to the pointer variants only.
:- Exception and Error types should have the "Error" or "Defect" suffix.
:- Unless marked with the {.pure.} pragma, members of enums should have an identifying prefix, such as an abbreviation of the enum's name.
<lang Nim>type
PathComponent = enum
pcDir
pcLinkToDir
pcFile
pcLinkToFile</lang>
:- Non-pure enum values should use camelCase whereas pure enum values should use PascalCase.
<lang Nim>type
PathComponent {.pure.} = enum
Dir
LinkToDir
File
LinkToFile</lang>
=={{header|OASYS Assembler}}==
|