init
	// A variable can be of more than one type.
	// It can take many forms (polymorphism)
	//
	// In the following example 'my_string' is created 
	// as a StringExample, but StringExample
	// also implements Measureable and Comparable
	// interfaces. So it passes the tests for those
	// types:
	var my_string = new StringExample( "abc" )
	if my_string isa Measureable
		show_length( my_string )
		print my_string.describe_length()
	if my_string isa Comparable
		print "Are the values alike? " + my_string.compare( "abc" ).to_string()
	// 'my_int' is created as an IntegerExample, a
	// different type to StringExample, but also
	// implements Measureable and Comparable
	// There is no need for type checking at run
	// time as the compiler will do this at compile
	// time. So in the following examples the type
	// checks are omitted:
	var my_int = new IntegerExample( 1234567 )
	show_length( my_int )
	print my_int.describe_length()
	print "Are the values alike? " + my_int.compare( 1234567 ).to_string()

// The following function uses an interface instead
// of the type of parameter (generics) syntax.
// It still allows multiple types to be passed.
// In this example both StringExample and
// IntegerExample work. It is, however, a poorly
// designed function because of the runtime type
// checking. What happens when a new implementation
// of Measurable is added?
// A search of the code base would be needed to add
// the new type to each conditional check.
// It would be better to include each specific
// output as a function within its own class
// definition. See describe_length() in this example.
def show_length( a:Measureable )
	if a isa StringExample
		print "StringExample is %i characters long", a.length()
	else if a isa IntegerExample
		print "IntegerExample is %i digits long", a.length()

// Definition of the interfaces:
interface Measureable
	def abstract length():int
	def abstract describe_length():string

// Example of an interface with the type as a parameter (generics)
interface Comparable of T
	def abstract compare( a:T ):bool

// Extra interface just to show many types in the later example
interface Nothing
	def abstract do_nothing()

// Below are the definitions of the classes in this example.
// Note that when the type is also a parameter (the 'of' keyword) the parser
// is looking for other parameterized types. So in this example, 'Nothing', 
// would be treated as another parameterized type and cause a compile time
// error. By placing 'string' in brackets, the parser is told all 
// parameterized types for the Comparable interface are listed
// in the brackets. See https://bugzilla.gnome.org/show_bug.cgi?id=611191
// for more details.
class StringExample:Object implements Measureable, Comparable of (string), Nothing
	_value:string
	construct ( a:string )
		_value = a
	def length():int
		return _value.length
	def describe_length():string
		return "StringExample is %i characters long".printf( length() )
	def compare( a:string ):bool
		if a == _value
			return true
		return false
	def do_nothing()
		pass

// In this example the paramater of type is at the end and so doesn't have to
// be in parentheses
class IntegerExample:Object implements Measureable, Nothing, Comparable of int
	_value:int
	construct ( a:int )
		_value = a
	def length():int
		return _value % 10
	def describe_length():string
		return "IntegerExample is %i digits long".printf( length() )
	def compare( a:int ):bool
		if a == _value
			return true
		return false
	def do_nothing()
		pass

