You can register to create an account and edit the pages of the Wiki.
PosInfos is most useful when it is set automatically by the Haxe compiler. Basically, if you have a method with an optional parameter of type "PosInfos", when you call that method, and you don't give a value, the Haxe compiler will automatically insert one for you. For example:
static function areEqual(a:Dynamic, b:Dynamic, ?p:haxe.PosInfos)
if (a != b)
trace (Std.string(a) + " was not equal to " + Std.string(b));
trace (" at " + p.fileName + ":" + p.lineNumber + " in method " + p.methodName);
If you now called that method:
the value for "p" would automatically be inserted and include all the information about the line that called the method - the file it was in, the line number, the method etc.
There are two common uses for this. The first is for trace functions (see http://haxe.org/doc/cross/trace) or assert functions (as in the example above), when you are debugging and the function should tell you something about where the code was called from.
The second common use is if the function's behaviour changes depending on where it was called from. For example, if you had a function "includeTemplate()", which included a different template depending on which class or method called it.
All rights reserved. Powered by Haxe