Aug 13, 2022Kuina-chan

1Kuin Naming Rules
1.1Characters That Can Be Used In Names
1.2Uppercase And Lowercase Rules
- Basically, name the word in lower case, and capitalize the beginning of the second and subsequent words when multiple words are concatenated.
- Abbreviations consisting of acronyms, such as "XML," are considered to be a single word in their entirety.
Reason For The Design
This rule is called camelcase, and the reason for this rule is that it reduces both the number of types and the amount of code.
It is also common to have different naming rules for global and local variables to avoid conflicts, but Kuin has a syntax rule that global variables should be prefixed with "@", so we use camelcase to unify them.
1.3Type Name Prefix Rules
- The first letter of user-defined type names, such as enumerated type names and class names, should be capitalized.
Reason For The Design
There are often cases where we define a class and want to create a variable with the same name as it, so we use this rule to prevent name conflicts in such cases.
1.4Source Code Naming Rules
- Source code names should be named in all lowercase.
- When multiple words are concatenated, place a "_" between each word.
Reason For The Design
Windows does not distinguish between upper and lower case letters in file names, so the same file "ABC" could be treated as a different file "abc" or "Abc", which could cause problems. Therefore, I decided to use lower case for all file names.
1.5Abbreviation Rules
- Do not abbreviate words of four letters or less.
- Abbreviate words that appear frequently in programming.
- Words that are often abbreviated conventionally are abbreviated.
- If the abbreviation duplicates or obscures the original word, do not abbreviate or use a different synonym.
Reason For The Design
If we didn't abbreviate words at all, there would be no risk of confusion, but the longer the program, the more complicated it becomes and the harder it is to grasp, so I decided to abbreviate as much as possible.
2Kuin Reserved Words
alias | assert | bit16 | bit32 |
bit64 | bit8 | block | bool |
break | case | catch | char |
class | const | dbg | default |
dict | do | elif | else |
end | enum | env | excode |
false | finally | float | for |
func | if | include | inf |
int | list | me | null |
queue | ret | skip | stack |
super | switch | throw | to |
true | try | var | while |
Reason For The Design
Kuin is syntactically distinguishable between identifiers and non-identifiers, so it is actually not a problem to allow "if", "for", etc. as variable names. However, the use of "if" in variable names is still a source of confusion, so I prohibited it as a reserved word.