Next: , Previous: Declarations, Up: Syntax

3.1.3 Object creation Explicit creation

Objects are created using the make keyword:

     var = make Class(param1, param2, ...);

make returns the object itself, which can be used in method calls. The parameters passed into make will be passed to the constructor.

Please note: As of 1.0a2, parent class constructors are not called (but any constructors in the given class matching the number of parameters are). Constructors that need to call parent constructors can use parent|__construct__(...), where parent is the name of one of the parent classes. Implicit creation

Objects are implicitly created when operators are run upon them (for instance, adding two numbers). The supported operators are listed under the Operators section above. Map/Reduce

Kite has built-in support for the map and reduce operators (<- and <|, respectively). Map applies a method to each element of an object (by default, any object that implements the iterator methods), while reduce constructs a single new object from another object using a method. For example:

     method mapping(a) [
         (a + 1);
     method reducing(a, b) [
         (a + b);

which outputs: