-
Notifications
You must be signed in to change notification settings - Fork 1
Coding Standards
Gulvan edited this page May 3, 2023
·
4 revisions
WIP
class SomeClass
{
...content...
}enum SomeEnum
{
ConstructorA;
ConstructorB(a:Int, b:String);
ConstructorC; //When enum has lots of constructors, it is okay to split them into groups by leaving an empty line
ConstructorD;
}public var baz(default, null):Int;public function foo(bar:T):S
{
// Do something
}public/private static/override inline functionAll code is 4-space indented
In any case, subsequent paragraphs of code may be separated by at most one empty line.
It is possible to omit the newline character after the colon in each case statement, but only if both conditions are met:
-
switchis used as a value (for example,return switchora = switch) -
Each body expression is simple enough
In this is the case, the constructs like this are allowed:
return switch this
{
case Resign: RESIGN_CONFIRMATION_MESSAGE;
case Abort: ABORT_CONFIRMATION_MESSAGE;
default: null;
}Almost all of the code in this repository is written in Allman style (meaning: opening bracket is always placed on the new line).
The only exception is when the left curly brace follows the binary operator.
For example, this is the case for the anonymous functions:
var callback:Int->Void = s -> {
// Do stuff...
};...and wrapped anonymous objects being assigned to a variable:
var obj:Dynamic = {
key1: value1,
key2: value2,
...
};