About Monkey 2

Posted on January 4th, 2016

Monkey2 is a new programming language designed by Mark Sibly, creator of the ‘Blitz’ range of languages.

While staying true to the ‘basic’ style of the original blitz languages, Monkey2 offers some very powerful new features including:

Generic classes and methods.

Classes, interfaces, structs, methods and functions can have ‘type’ parameters:

‘First class’ functions.

Functions (and methods) can be stored in variables and passed to/from other functions.

Lambda functions.

Lambda functions allow you to create closures:

New ‘struct’ type that provides value semantics.

Structs are similar to classes in that they encapsulate member data, but differ in that they are passed around ‘by value’ instead of ‘by reference’.

This allows structs to be efficiently created on the stack without any garbage collection overhead.

Fibers for easy asynchronous programming.

Fibers provide support for ‘cooperative’ multithreading:

Operator overloading.

Operator overloading allows you to override the meaning of the built-in language operators, making for more expressive code:

Class extensions.

Class extensions allow you to add extra methods and functions to existing classes.

Fully garbage collected.

Monkey2 provides a ‘mostly’ incremental garbage collector that efficiently collects garbage as it runs without any of those annoying ‘sweep’ spikes found in typical garbage collectors.

Optional reflection features.

Monkey2 includes an optional reflection system that allows you to inspect and modify variables and values at runtime:

Multi-target

Monkey2 works on a wide range of targets: Windows, Macos, Linux, Emscripten, Android and iOS.