HaXe API Conventions
From dis-Emi-A
Contents |
Function Naming
Static Constructors
Static functions which create an object of the enclosing type shall be named as an adjective describing the style of object being created.
Example: ui.Brush.solid
A class may have either static constructors and a private "new" function, or a public "new" and no static constructors.
Additionally such functions will be marked with /*ctor*/
Standard Pattern: factory method
Event Handlers
Functions which are called directly as the result of a received event are preceded with "on" in their Name. A single function may be used for multiple events if the type/parameters of the event are not important to the function.
Example: onMouse
Partial Abstract Functions
Functions which are intended to be abstract in a class, and will be called by the base class, are preceded with a single underscore "_". This implies that the immediately derived class must override this method, and must not call the super version.
Example: _resize
Haxe has no native construct for such functions, nor does any language I know.
Additionally the function will be marked as /*abstract*/
Abstract Fucntions
Functions which are not defined in the current class but will be called directly by users of the class. These will be marked with /*abstract*/
Haxe has no native construct for such functions outside of an interface definition.
True Private Functions
Functions which the derived classes are not supposed to call are preceded with a double underscore "__".
Haxe has no native construct for such functions, and private tends to behave like protected.
Additionally the function will be marked as /*hidden*/
Final Functions
Functions which can be overriden by derived classes are considered virtual, those which cannot be overriden, or which have terminal in the current class, are final.
There can be no naming convention for such functions and are thus just marked as /*final*/ for now.
Haxe has no native construct for such functions.
Virtual Functions
Though functions are virtual by default, those which are specifically meant to be overriden (or optionally overriden) will be marked with /*virtual*/
