HaxeDoc2
Trivia: Accessor names In Haxe 2, arbitrary identifiers were allowed as access identifiers and would lead to custom accessor met ...
1 var Main = function() { 2 var v = this.get_x(); 3 this.set_x(2); 4 var _g = this; 5 _g.set_x(_g.get_x() + 1); 6 }; As specifie ...
4 5 class Main extends Base { 6 // ok, get_x is declared by parentclass 7 public var x(get, null):Int; 8 9 static public functio ...
10 function set_x(x){ 11 return this.x = x; 12 } 13 14 static public function main() {} 15 } If a physical field is indeed inten ...
3.have a return type (here:Void), 4.may have access modifiers (4.4) (here:staticandpublic) and 5.may have an expression (here:{t ...
the classBasewhich has a methodmyMethodand a constructor, the classChildwhichextends Baseand also has a methodmyMethodbeing dec ...
1 class MyClass { 2 static public function available() { 3 unavailable(); 4 } 5 static private function unavailable() { } 6 } 7 ...
3.If the field overrides (4.3.1) a public field. Trivia: Protected Haxe has no notion of aprotectedkeyword known from Java, C++ ...
1 class Main { 2 public static function main () { } 3 4 static function test() { 5 if (Math.random() > 0.5) { 6 return "ok"; ...
Chapter 5 Expressions Expressions in Haxe define what a programdoes. Most expressions are found in the body of a method (4.3), w ...
4 ... 5 exprN; 6 } The value and by extension the type of a block-expression is equal to the value and the type of the last sub- ...
The generated code may be less concise on platforms that do not support array initialization. Essentially, such initialization c ...
5.9 Function Call Functions calls consist of an arbitrary subject expression followed by an opening parenthesis(, a comma,separa ...
Rvalue functions may have a name, but cannot have type parameters. 5.12 new.............................................. Then ...
5 trace(f); 6 f = Math.random(); 7 } 8 } 9 } This kind of while-loop is not guaranteed to evaluate the loop body expression at a ...
1 switch subject { 2 case pattern1: case-body-expression-1; 3 case pattern2: case-body-expression-2; 4 default: default-expressi ...
6 expression; 7 } Thereturnleaves local functionf2, but notf1, meaningexpressionis still evaluated. Ifreturnis used without a va ...
5.23 cast Haxe allows two kinds of casts: 1 cast expr; // unsafe cast 2 cast (expr, Type); // safe cast 5.23.1 unsafe cast...... ...
In this example we first cast a class instance of typeChild1toBase, which succeeds because Child1is a child class (2.3.2) ofBase ...
Chapter 6 Language Features 6.1 Conditional Compilation.................................. Haxe allows conditional compilation by ...
«
6
7
8
9
10
11
12
13
14
15
»
Free download pdf