Meta-object protocol

println(32.class); // emits "<int>"
MetaClass c = int;  // ref to a class get's its metaclass
println(c);         // refers to int's MetaClass
MetaClass meta = int.class; // ref to a class's class get's MetaClass
println(meta);      // refers to MetaClass of int's MetaClass == MetaClass

int x = c.new();    // make new instance of an int via metaclass
                    // not using inefficient reflection in java
                    // as it calls mint.mnew(), which does new mint(); fast :)
println(x);                             

Every object has a default copy() method that uses Java reflection to copy all of the fields (this is a shallow copy). deepCopy() exists but is not implemented yet.

string s = "foo";
println(s.copy()); // emits "foo"
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.