-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSTYLE
59 lines (39 loc) · 1019 Bytes
/
STYLE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
-----------
Line length
Aim for ~120 max. Unless you have a good reason.
That is out to -------------------------------------------------------------------------------------------------------->
-----------
Brace and indentation style
public function foo()
{
...
}
class Foo
{
public var x : Int;
public var y : Int;
public var z : Int;
public function new(x,y,z)
{
this.x = x;
this.y = y;
this.z = z;
}
...
}
or
public function mini() { ... }
class Mini {public var x : Int; public var y : Int; public var z : Int;
public function new(x,y,z) { this.x = x; this.y = y; this.z = z; } }
If the function or class is taking more than 2-3 lines, don't use the mini style.
-----------
Naming conventions
ClassNameIsCamelCase
methodsAreLowerCamelCase
variables_are_snaky_case
compactvarsoksometimes (mostly as locals and really common stuff)
CONSTANT_OR_GLOBAL
If you aren't using a parameter you can call it "_" instead.
-----------
Other things
Don't nest ternaries.